Home  >  Article  >  Web Front-end  >  How jquery determines whether the browser is ie6

How jquery determines whether the browser is ie6

coldplay.xixi
coldplay.xixiOriginal
2020-12-11 11:11:081899browse

How jquery determines whether it is an ie6 browser: Use [$.support.style] to determine, the code is [if ($.browser.msie && ($.browser.version == “6.0″) && !$.support.style)].

How jquery determines whether the browser is ie6

The operating environment of this tutorial: windows7 system, jquery3.2.1 version, thinkpad t480 computer.

Recommended: jquery video tutorial

Jquery method to determine whether it is an ie6 browser:

jquery API Medium

$.browser Browser kernel identifier Available values: safari opera msie mozilla

$.browser.version Browser rendering engine version number Typical results: Internet Explorer: 6.0, 7.0 Mozilla/Firefox/Flock/Camino: 1.7.12, 1.8.1.3 Opera: 9.20 Safari/Webkit: 312.8, 418.9

$.support.style A group used to display different browsers Collection of properties for respective features and bugs.

if ($.browser.msie && ($.browser.version == “6.0″) && !$.support.style) {
//代码
}

Final complete code:

    //判断是否按回车,如果是则提交表单
    if ($.browser.msie && ($.browser.version == "6.0") && !$.support.style) {
        $("#login_form").keypress(function(e){
            var e = e || window.event;
            var keycode = e.which || e.keyCode;
            if (keycode==13) {
                $("#clogin").trigger("click");
            }
        });
    } else {
        $("#login_form").keydown(function(e){
            var e = e || window.event;
            var keycode = e.which || e.keyCode;
            if (keycode==13) {
                $("#clogin").trigger("click");
            }
        });
    }

Related free learning recommendations: javascript (Video )

The above is the detailed content of How jquery determines whether the browser is ie6. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn