[英]conditional comments not working
I am extreamly new to HTML, 我对HTML非常陌生,
my goal is to set a global js variable to true when my website is running on IE. 我的目标是在我的网站在IE上运行时将全局js变量设置为true。
I started by writing 我开始写
<script> var runningIE = false;</script>
<!--[if IE ]>
Special instructions for IE here
<script> runningIE = true;</script>
<![endif]-->
no matter where I put this code (header, body) I don't see Special instructions for IE here
printed anywhere not runningIE would be set to true on IE. 无论我将这段代码放在哪里(标题,正文),我都不会看到
Special instructions for IE here
未运行Special instructions for IE here
会在IE上设置为true。
What am I missing here? 我在这里想念什么?
您可能正在IE 10中进行测试,它不支持条件注释(首先浏览器嗅探并不是一个好主意,并且自从将大量IE特定修复程序投入其中以来,IE已有了很大改进。 condcom)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.