Home  >  Article  >  Web Front-end  >  What should I do if jquery is not compatible with IE browser?

What should I do if jquery is not compatible with IE browser?

coldplay.xixi
coldplay.xixiOriginal
2020-11-18 14:31:322315browse

Solutions to jquery being incompatible with IE browsers: 1. You can use native JS or a lower version of [Jquery1.x]; 2. You can write two or more sets of JS codes for the web page to adapt to different versions. , different types of browsers.

What should I do if jquery is not compatible with IE browser?

Recommendation: "jquery video tutorial"

Solution to the problem that jquery is not compatible with IE browser:

1. You can use native JS or a lower version of Jquery1.x. Because Jquery no longer handles compatibility with lower versions of IE (IE6, IE7, IE8) starting from version 2.x. If you need to be compatible with lower versions of IE, it is recommended to use native JS or lower versions of Jquery1.x.

2. You can write two or more sets of JS codes for the web page to adapt to different versions and types of browsers, and then use native JS to determine the browser model and version to load different JS files.

The specific implementation method is as follows:

<script language="javascript">
//判断是否为IE浏览器
if(navigator.appName == "Microsoft Internet Explorer") {
if(navigator.appVersion.match(/7./i) == &#39;6.&#39; || navigator.appVersion.match(/7./i) == &#39;7.&#39; || 
navigator.appVersion.match(/7./i) == &#39;8.&#39;) {
document.write("<script src=\"myjs1.js\">" + "</script>"); 
} 
else{ 
document.write("<script src=\ "myjs2.js.js\">"+"</script>"); 
} 
} 
</script>

Related free learning recommendations: JavaScript (video)

The above is the detailed content of What should I do if jquery is not compatible with 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