문제

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.

도움이 되었습니까?

해결책

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
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top