Pergunta

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.

Foi útil?

Solução

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
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top