简体   繁体   中英

Disable IE10 clear field in Compatibility mode

I don't want the clear functionality (the X button) in text boxes rendered in IE10 and above. For this, I'm setting the display of the pseudo element -ms-clear to none . However, it still shows up when IE is running in Compatibility mode. Since this is an Intranet site, it will always run in Compatibility mode. And there's no workaround for this: http://connect.microsoft.com/IE/feedback/details/783743/disable-ie10-clear-field-button-when-rendering-in-compatibility-mode

Using <add name="X-UA-Compatible" value="IE=edge" /> in web.config to force IE to run in standard mode is not recommended as per msdn, as far as production scenarios are concerned. Is there any other way of getting round this?

根据microsfts的官方回复“你报告的问题是设计的。”这里是微软链接官方回复的链接

While it is definitely not recommended in all cases to set X-UA-Compatible header to IE=edge , since it leaves control out of your hands which 'edge' version is being selected, this entirely depends on you trusting your code enough to be sufficiently HTML5-compliant to keep rendering correctly in future browsers. If you do, you can ignore the recommendation not to use IE=edge , that's why it's a recommendation and not forbidden .

More conservatively you could also opt to select a fixed version. If your audience is using a mixed bag of IE9, 10 and 11 installs, and you're sure it works fine in IE9 - use this:

<add name="X-UA-Compatible" value="IE=9" />

This will make all more recent IE's than 9 also render it in IE9 standards compliant mode, which is much better than basic compatibility mode (which is essentially IE7 Quirks).

In a nutshell - recommendations are just that, and can safely be ignored if you are aware of the consequences and take proper precautions.

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