问题
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!
回答1:
You can check if ($.browser.msie && $.browser.version < 8)
and not run your code.
回答2:
Use conditional comments.
http://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx
<![if !(IE 7)]>
// Script tags here
<![endif]>
回答3:
You can´t turn JavaScript off. You can however exclude IE7 by using Downlevel-revealed Conditional Comments.
来源:https://stackoverflow.com/questions/6333878/how-to-switch-off-javascript-programmatically-only-for-internet-explorer-7