根据IE版本加载不同的脚本版本 [英] Loading different scripts versions depending on IE version

查看:167
本文介绍了根据IE版本加载不同的脚本版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net mvc 4 Web应用程序,必须与IE 7兼容到IE 10然后根据IE使用我有一些脚本版本(jquery等)的问题所以在我的根脚本文件夹下我创建了一个名为OlderIE的新文件夹。使用IE 7时,我希望加载OlderIE文件夹中的脚本。当使用IE> 7时,我想要加载Scripts根文件夹中的脚本。那么怎么做?

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?

与此相关,是否可以在我的asp.net mvc 4项目中安装不同版本的脚本(jQuery,jQuery不引人注目等等) 。)并根据IE版本使用它们?

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?

更新
我想要这个因为我使用的是jquery-1.9.1当使用IE> = 8时,它的所有依赖关系,但它在IE 7中不起作用。因此,当使用IE 7时,我使用jquery-1.6.4及其依赖项(jquery unobtrusive等)。所以我想知道如何做到这一点。在同一个Project中是否可以安装多个版本的jquery,jquery unobtrusive等?如果是这样,如何执行此操作以及如何根据所使用的IE加载正确的?

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?

推荐答案

您可以使用条件注释。例如,如果您希望某些内容仅由IE7使用,则可以使用以下代码。

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]-->

您还可以设置大于或低于条件,例如IE版本低于IE9。

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

这篇关于根据IE版本加载不同的脚本版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆