0

I have been working an a static website for my job. It is currently being deployed for use and I'm running into a few problems. The link that points to the site opens it in IE (and most people here use IE as their browser) and by default it runs in Compatibility Mode. Because of this, the site isn't displayed properly. I found a solution to add

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

to my header and it works great. The only problelm is that I would have to add it to each page which is not feasible.

I decided it would be better to check for the IE browser and provide an alert message with a link to instructions on how to turn off Compatibility Mode.

The code works fine, my only issue is that even when Compatibility Mode is turned off by the user, the alert will still appear.

After playing around, I noticed in the browser's console that there's an info message:

HTML1202: < site > is running in Compatibility View because 'Display intranet sites in Compatibility View' is checked.

and after testing, it does go away after following the instructions I provided to the user.

My question is: would it be possible to read the console or store its log and check for this specific message so I can modify my code to only show the alert when the message appears?

c2bh2016
  • 55
  • 6
  • This might be helpful https://stackoverflow.com/questions/27912296/ie11-detect-whether-compatibility-view-is-on-via-javascript – Ason Apr 18 '18 at 19:23
  • I don't think you can read messages printed to the console. But have a look at https://stackoverflow.com/questions/14791619/detect-ie10-compatibility-mode for detecting compatibility mode. – DutChen18 Apr 18 '18 at 19:26
  • I did try that; forgot to mention. The problem with that was that I'm using sweetalert and the alert won't show unless I have the meta tag. So, the browser will always read that its not in compatibility mode. Am I just out of luck here? – c2bh2016 Apr 19 '18 at 11:27

0 Answers0