Example usage for com.vaadin.client BrowserInfo getGeckoVersion

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

Introduction

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

Prototype

public float getGeckoVersion() 

Source Link

Document

Returns the Gecko version if the browser is Gecko based.

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 av  a2  s.  c  om*/
        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");
        }
    }
}