Check if user is using IE with compatibility mode

人盡茶涼 提交于 2019-12-05 20:42:02

问题


I am looking for some code (either PHP or JavaScript) would work well to check if a user viewing a page is using compatibility mode.

Then I can use that code to do some conditional statements, or basically give them a notification to turn it off.


回答1:


Force them to:

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

This will disable Compatibility View, unless the user then goes and specifically turns it off by going into the Developer Tools and changing it.




回答2:


I use:

try{ JSON } catch (e){ alert("Compatibility Mode Detected")  }


来源:https://stackoverflow.com/questions/10020011/check-if-user-is-using-ie-with-compatibility-mode

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