Home >Web Front-end >JS Tutorial >jquery method to determine whether it is an ie browser
How jquery determines whether it is an IE browser: first create a front-end code sample file; then use the "jquery.browser" method to determine whether it is an IE browser.
The operating environment of this tutorial: windows7 system, jquery1.2.6 version, this method is suitable for all brands of computers.
Recommendation: "jquery video tutorial"
You can use jquery.browser to determine whether it is an IE browser.
$.browser property has been removed in jQuery 1.9. Used to return information about the browser currently used by the user.
Syntax: $.browser
Parameters:
Example:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript"> $(function() { var userAgent = window.navigator.userAgent.toLowerCase(); $.browser.msie10 = $.browser.msie && /msie 10\.0/i.test(userAgent); $.browser.msie9 = $.browser.msie && /msie 9\.0/i.test(userAgent); $.browser.msie8 = $.browser.msie && /msie 8\.0/i.test(userAgent); $.browser.msie7 = $.browser.msie && /msie 7\.0/i.test(userAgent); $.browser.msie6 = !$.browser.msie8 && !$.browser.msie7 && $.browser.msie && /msie 6\.0/i.test(userAgent); $(".info").html( "<h3>userAgent:</h3>" + userAgent + "<br />" + "<h3>Is IE 10?</h3>" + $.browser.msie10 + "<h3>Is IE 9?</h3>" + $.browser.msie9 + "<h3>Is IE 8?</h3>" + $.browser.msie8 + "<h3>Is IE 7?</h3>" + $.browser.msie7 + "<h3>Is IE 6?</h3>" + $.browser.msie6 ); }); </script> <body> <div class="info"></div> </body>
The above is the detailed content of jquery method to determine whether it is an ie browser. For more information, please follow other related articles on the PHP Chinese website!