简体   繁体   English

Internet Explorer + Windows Phone IEMobile条件注释

[英]Internet Explorer + Windows Phone IEMobile Conditional Comments

So I've been using these two combinations of IE conditionals: 因此,我一直在使用IE条件句的以下两种组合:

<!--[if (IE)|(IEMobile)]>
    <script type="text/javascript">
        // Do something
    </script>
<![endif]-->

<!--[if (!IE)|(!IEMobile)]>
    <script type="text/javascript">
        // Do something else
    </script>
<!--<![endif]-->

So could such combinations work in production environment? 这样的组合在生产环境中可以工作吗? I tried testing with IE 11 emulated to any previous version of IE and I got these results: 我尝试使用IE 11进行测试,以模拟到任何以前的IE版本,并得到以下结果:

  • The first one worked on IE for PC; 第一个在PC的IE上工作;
  • The second one failed exposing its contents to IE for PC; 第二个未能将其内容公开给PC的IE;
  • I've not tested the IEMobile contrary because I don't have Windows Phone, so I can't be sure if some of these works on it. 我没有测试IEMobile,因为我没有Windows Phone,所以我不确定其中是否可以使用这些功能。 Any suggestions? 有什么建议么?

I am not sure what you want to do, but you should give feature detection a change. 我不确定您要做什么,但是您应该对功能检测进行更改。 Instead of using browser detection. 而不是使用浏览器检测。 Try http://modernizr.com/ With it you can do something like that: 尝试使用http://modernizr.com/ ,您可以执行以下操作:

if(Modernizr.touch){
    // Do something
} else {
    // Do something else
}

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

相关问题 添加特定于Windows Phone Internet Explorer的代码 - Adding code specific to Windows Phone Internet Explorer 有没有办法使用JavaScript引入Internet Explorer条件注释? - Is there a way to introduce Internet Explorer conditional comments using JavaScript? 是什么使Internet Explorer无法正确处理条件注释? - What would make Internet Explorer NOT process conditional comments properly? Windows Phone Internet Explorer Mobile 7浏览器是否支持触摸事件? - Does the Windows Phone Internet Explorer Mobile 7 browser support touch events? 如何区分Internet Explorer 10 / Windows Phone 8中的单击和触摸事件 - How to distinguish click and touch events in Internet Explorer 10 / Windows Phone 8 如何在 Windows Phone 7 上调试 Internet Explorer? - How do I debug Internet Explorer on Windows Phone 7? Internet Explorer的条件文档类型 - Conditional Doc Type for Internet Explorer 如何在Windows Phone 8 OS的诺基亚Lumina 92​​5中的Internet Explorer中禁用Java脚本? - How to disable java script in internet explorer in nokia lumia 925 in windows phone 8 os? 无法单击Windows Phone 8.1 Internet Explorer上的动态加载的单选按钮 - Can't click dynamically loaded radio button on Windows Phone 8.1 Internet Explorer 弹出窗口,例如Internet Explorer最喜欢的Windows - Popup windows like Internet Explorer Favorite Windows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM