Question

Is it possible to change the IE document mode with Javascript? I won't get into the nitty-gritty details here, but I'm fighting with a locked down Drupal site that will not allow me any acces to edit the theme files. Obviously, the correct thing to do would be to write something into the head, like this:

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

But, as I mentioned, I have no access to that part of the page, so I'm hoping that I can use Javascript... sort of like this:

document.getElementsByTagName('head')[0].appendChild('<meta http-equiv="X-UA-Compatible" content="IE=IEVersion">');

Sadly, this doesn't work.

Was it helpful?

Solution

That's a bit of a pickle you're in. What about this?

if (navigator.userAgent.indexOf("MSIE 7.0")) {
    // add conditional css in here
} else {
    // default css
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top