Check if user is using IE with compatibility mode

2019-04-06 15:34发布

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.

2条回答
Root(大扎)
2楼-- · 2019-04-06 16:11

I use:

try{ JSON } catch (e){ alert("Compatibility Mode Detected")  }
查看更多
爷、活的狠高调
3楼-- · 2019-04-06 16:12

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.

查看更多
登录 后发表回答