TIM*_*MEX 65 html javascript css internet-explorer-9
<!--[if lt IE 9]>
This is less then IE9
ELSE
this is all browsers: firefox, chrome, etc.
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
我如何在我的HTML中执行此操作?我想做一个"别的"......
cwa*_*ole 110
你不是在寻找别的,你正在寻找<![if !IE]> <something or other> <!--[endif]>(注意这不是评论).
<!--[if IE]>
You're using IE!
<![endif]-->
<![if !IE]>
You're using something else!
<![endif]>
Run Code Online (Sandbox Code Playgroud)
您可以在此处找到有关条件评论的文档.
Jha*_*bub 43
我使用以下内容在IE9或更新版本和所有其他浏览器中加载资源
<!--[if gte IE 9]><!-->
//your style or script
<!--<![endif]-->
Run Code Online (Sandbox Code Playgroud)
这很难相信.查看开始和结束if语句部分是否在注释内(因此,它对其他浏览器不可见)但对IE可见.
Ruu*_*uut 12
您的问题的解决方案是(注意使用<!-- -->):
<!--[if lt IE 9]>
This is less then IE9
<![endif]-->
<!--[if gt IE 8]> <!-- -->
this is all browsers: IE9 or higher, firefox, chrome, etc.
<!-- <![endif]-->
Run Code Online (Sandbox Code Playgroud)
条件注释可以在脚本中以及在html-中
/*@cc_on
@if(@_jscript_version> 5.5){
navigator.IEmod= document.documentMode? document.documentMode:
window.XMLHttpRequest? 7: 6;
}
@else{
alert('your '+navigator.appName+' is older than dirt.');
}
@end
@*/
Run Code Online (Sandbox Code Playgroud)