Home  >  Article  >  Web Front-end  >  jquery method to determine whether it is an ie browser

jquery method to determine whether it is an ie browser

藏色散人
藏色散人Original
2020-12-18 09:25:591983browse

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.

jquery 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:

jquery method to determine whether it is an ie browser

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!

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