Example usage for com.vaadin.client BrowserInfo getBrowserMajorVersion

List of usage examples for com.vaadin.client BrowserInfo getBrowserMajorVersion

Introduction

In this page you can find the example usage for com.vaadin.client BrowserInfo getBrowserMajorVersion.

Prototype

public int getBrowserMajorVersion() 

Source Link

Document

Returns the browser major version e.g., 3 for Firefox 3.5, 4 for Chrome 4, 8 for Internet Explorer 8.

Usage

From source file:com.haulmont.cuba.web.toolkit.ui.client.passwordfield.CubaPasswordFieldWidget.java

License:Apache License

public void setAutocomplete(boolean autocomplete) {
    if (autocomplete) {
        getElement().removeAttribute("autocomplete");
    } else {/*from   w  ww. j  a  v  a  2 s .  com*/
        BrowserInfo browser = BrowserInfo.get();

        if (browser.isIE() || (browser.isGecko() && browser.getGeckoVersion() < 47)
                || (browser.isChrome() && browser.getBrowserMajorVersion() < 49)) {
            getElement().setAttribute("autocomplete", "off");
        } else {
            getElement().setAttribute("autocomplete", "new-password");
        }
    }
}