abdul raheem
abdul raheem

Reputation: 9

IE default version is changed to 7 automatically

i have added the bellow piece of code in my js file.

var meta = document.createElement('meta');
meta.httpEquiv = "X-UA-Compatible";
meta.content = "IE=edge, IE=11, IE=10, IE=9";
document.getElementByTagName('head')[0].appendChild(meta);

But after changing this My IE browser is changed its default version to 7 from 11.

kindly let me know why it was changed.

Upvotes: -1

Views: 338

Answers (2)

Zhi Lv
Zhi Lv

Reputation: 21646

We could use JavaScript to add meta tag or modify the meta tag content, but, it will be generated after the page is loaded. So, if you use F12 developer tools to check, you can see that: the meta tag content value and the Browser Document mode are not matched.

More details information, please refer to the following screenshot:

enter image description here

So, in my opinion, I suggest you could directly add meta tag in the head. instead of via JavaScript.

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

Upvotes: 0

gvozd1989
gvozd1989

Reputation: 300

You have a lost b letter in X-UA-Compatible. And you cannot set multiple versions in content.

Upvotes: 0

Related Questions