如何为不同版本的IE加载不同的脚本?
我使用这些脚本来修复 IE 中的错误(黑客)。
每个版本都有一个。
我知道所有东西都有 IE9.js IE8 和 7,但想加载 仅该版本浏览器所需的脚本;
今天我的代码如下:
<!--[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]-->
我不想使用像
我不知道是否还有else
,我在网上搜索了一下,没有看到有人对此发表评论。但这将是理想的解决方案。
类似这样的事情:
<!--[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 use these scripts to repair the errors in IE (Hacks).
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;
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.
I do not know if there is else
, I searched the internet and did not see anyone commenting on this. 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题已解决。
Problem solved.