How to switch off JavaScript programmatically only

2019-03-03 09:21发布

I want to turn off JavaScript using JavaScript (and/or jQuery) code, only if the page is viewed in IE7.

How can this be done?

Would be grateful for the magic code snippet!

3条回答
一纸荒年 Trace。
2楼-- · 2019-03-03 09:45

Use conditional comments.

http://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx

<![if !(IE 7)]>
    // Script tags here
<![endif]>
查看更多
孤傲高冷的网名
3楼-- · 2019-03-03 10:00

You can check if ($.browser.msie && $.browser.version < 8) and not run your code.

查看更多
▲ chillily
4楼-- · 2019-03-03 10:03

You can´t turn JavaScript off. You can however exclude IE7 by using Downlevel-revealed Conditional Comments.

查看更多
登录 后发表回答