Loading different scripts versions depending on IE version

流过昼夜 提交于 2019-12-13 00:49:59

问题


I have an asp.net mvc 4 web application that must be compatible with IE 7 to IE 10 and then depending on the IE used I have problems with some scripts version (jquery, etc.) so under my root scripts folder I have created a new folder called OlderIE. When IE 7 is used I want the scripts in OlderIE folder to be loaded. And when IE > 7 is used, the I want scripts in Scripts root folder to be loaded. So how to do this?

Related to this, is it possible to have installed in my asp.net mvc 4 project different versions of scripts (jQuery, jQuery unobtrusive, etc.) and use them depending on IE version?

UPDATED: I want this because I am using jquery-1.9.1 and all its dependencies when using IE >= 8 but it is not working in IE 7. so when using IE 7 I use jquery-1.6.4 and its dependencies (jquery unobtrusive, etc.). So I want to know how to do this. Is it posible in the same Project to have multiple versions of jquery, jquery unobtrusive, etc. installed? If so, how to do this and how to load the correct ones depending on the IE being used?


回答1:


Use this plugin to get version and name of browsers.

http://jquery.thewikies.com/browser/




回答2:


You can use conditional comments. For example, if you want something to be used only by IE7 you can use the following code.

<!--[if IE 7]>
According to the conditional comment this is IE 7<br />
<![endif]-->

You can also put "greater than" or "lower than" conditions, e.g. for IE versions lower than IE9.

<!--[if lt IE 9]>
According to the conditional comment this is IE lower than 9<br />
<![endif]--> 

Inside these comments you can put your scripts.

For more info you can read this



来源:https://stackoverflow.com/questions/19315947/loading-different-scripts-versions-depending-on-ie-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!