Home > Web Front-end > JS Tutorial > body text

How jquery determines whether the browser is ie6

coldplay.xixi
Release: 2023-01-04 09:36:54
Original
2016 people have browsed it

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) {
//代码
}
Copy after login

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");
            }
        });
    }
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template