How to switch off JavaScript programmatically only for Internet Explorer 7?

限于喜欢 提交于 2019-12-04 06:32:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!