简体   繁体   English

为所有浏览器(IE 8及更低版本)运行的条件注释

[英]Conditional Comment to run for all browsers except IE 8 and below

how can i write a conditional comment for scripts that should run for all browsers except IE 8 and below? 如何为应在除IE 8及以下版本的所有浏览器上运行的脚本编写条件注释?

i saw Conditional comment for 'Except IE8' ? 我看到了“除了IE8”的条件注释?

but how do i adapt it to include scripts files not inline scripts? 但是我如何适应它以包括脚本文件而不是内联脚本?

The trick explained there would work just as well for external scripts — set a "this browser is old" flag in a conditional-commented inline script, and have your external scripts check for that flag. 技巧说明了,该脚本对于外部脚本也同样适用-在带条件注释的内联脚本中设置“此浏览器较旧”标志,并让您的外部脚本检查该标志。

If you mean to conditionally include entire script files, your best bet would probably be a script that browser-sniffs and dynamically includes the appropriate files. 如果您打算有条件地包括整个脚本文件,那么最好的选择可能是浏览器嗅探并动态包括适当文件的脚本。 Otherwise, you could use downlevel-revealed conditional comments (thanks, bobince!). 否则,您可以使用下层显示的条件注释 (谢谢,bobince!)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM