[英]How to load different scripts for different versions of IE?
I use these scripts to repair the errors in IE (Hacks). 我使用这些脚本来修复IE(错误)中的错误。
There is one for each version. 每个版本都有一个。
I know that everything has IE9.js IE8 and 7 but would like to load only the necessary script to that version of the browser;
我知道所有内容都具有IE9.js,IE8和7,但只想将必要的脚本加载到该版本的浏览器中;
Today my code is as follows: 今天我的代码如下:
<!--[if lt IE 7]>
<script src="@Url.Content("~/Scripts/IE7.js")"></script>
<script src="@Url.Content("~/Scripts/ie7-squish.js")"></script>
<![endif]-->
<!--[if lt IE 8]>
<script src="@Url.Content("~/Scripts/IE8.js")">IE7_PNG_SUFFIX=".png";</script>
<script src="@Url.Content("~/Scripts/ie7-squish.js")"></script>
<![endif]-->
<!--[if lt IE 9]>
<script src="@Url.Content("~/Scripts/IE9.js")"></script>
<script src="@Url.Content("~/Scripts/ie7-squish.js")"></script>
<![endif]-->
I would not like to use something like <!--[if eq IE 8]>
because I do not know how it would behave in such versions as IE8.5. 我不想使用
<!--[if eq IE 8]>
因为我不知道它在IE8.5等版本中的表现如何。
I do not know if there is else
, I searched the internet and did not see anyone commenting on this. 我不知道是否还有
else
,我在互联网上搜索时没有看到任何对此发表评论的人。 But it would be the ideal solution. 但这将是理想的解决方案。
Something like this: 像这样:
<!--[if lt IE 7]>
<script src="@Url.Content("~/Scripts/IE7.js")"></script>
<script src="@Url.Content("~/Scripts/ie7-squish.js")"></script>
<![elseif lt IE 8]-->
<script src="@Url.Content("~/Scripts/IE8.js")">IE7_PNG_SUFFIX=".png";</script>
<script src="@Url.Content("~/Scripts/ie7-squish.js")"></script>
<![elseif lt IE 9]-->
<script src="@Url.Content("~/Scripts/IE9.js")"></script>
<script src="@Url.Content("~/Scripts/ie7-squish.js")"></script>
<![endif]-->
I appreciate the help. 感谢您的帮助。
You do not need to include IE7/IE8.js if you are using IE9.js
如果您使用的是IE9.js,则无需包含IE7 / IE8.js
<!--[if lt IE 9]>
<script src="@Url.Content("~/Scripts/IE9.js")"></script>
<script src="@Url.Content("~/Scripts/ie7-squish.js")"></script>
<![endif]-->
Problem solved. 问题解决了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.