简体   繁体   中英

Asp.net web page force document mode edge in IE?

I have a webpage that is not working properly in IE unless I hit F12 and change the document mode to "Edge" under emulation. Is this something I can do programmatically on the page so the user does not have to do this? TIA

You could try adding the X-UA-Compatible META tag. This belongs in your <head>

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

Internet Explorer allows you to define which version's engine is used to render a page using the X-UA-Compatible META tag or HTTP header. A specific version can be designated or the latest version using the 'IE=edge' value.

You can also add custom HTTP headers in the ASP.NET web.config:

<configuration> 
   <system.webServer> 
      <httpProtocol> 
         <customHeaders> 
            <add name="X-UA-Compatible" value="IE=edge" /> 
         </customHeaders> 
      </httpProtocol> 
   </system.webServer> 
</configuration>

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