简体   繁体   中英

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.

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

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:

在此处输入图像描述

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" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM