Connect and share knowledge within a single location that is structured and easy to search. Since this meta tag is only directed for IE all you need to do is add a IE conditional. This answer is based on examining the complete rules for deciding document mode in IE8, IE9, and IE10. Note that looking at the DOCTYPE is the very last fallback for deciding the document mode. If both the meta tag and the HTTP header are specified, the meta tag takes precedence.
Structure & Elements
This answer was posted several years ago and now the question really should be should you even consider using the X-UA-Compatible tag on your site? With the changes Microsoft has made to its browsers (more on those below). By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Note Starting with IE11, edge mode is considered the preferred document mode. (In earlier versions, it was considered experimental.) To learn more, see Document modes are deprecated. Starting with Windows Internet Explorer 8, some web developers used the edge mode meta element to hide the Compatibility View button on the address bar. As of IE11, this is no longer necessary as the button has been removed from the address bar. Because it forces all pages to be opened in standards mode, regardless of the version of Internet Explorer, how to use trello for software development you might be tempted to use edge mode for all pages viewed with Internet Explorer. Don’t do this, as the X-UA-Compatible header is only supported starting with Internet Explorer 8.
Disable unsafe inline code and only allow HTTPS resources
There’s also a checkbox to use Compatibility View for all websites, regardless of DOCTYPE. As this answer is now 10+ years old my recommendation would be to leave this tag out altogether, unless you must support old legacy browsers. When IE market sharing was decreasing, MS realized staying standard incompatible was not a good idea. Therefore MS started to release new IE version (IE8/IE9/IE10) respecting more and more the web standards. As IE6 was not respecting Web standards, developers had to test their website using IE6. Google Chrome Frame seamlessly enhances your browsing experience in Internet Explorer.
- However, at this time, Mozilla started Firefox development respecting as much as possible all the web standards (other browser were implemented to render pages as done by IE6).
- Find centralized, trusted content and collaborate around the technologies you use most.
- With the changes Microsoft has made to its browsers (more on those below).
- This article explores the significance of browser caching and demonstrates the use of meta HTML tags to enhance web speed.
- When IE market sharing was decreasing, MS realized staying standard incompatible was not a good idea.
What kind of Experience do you want to share?
Because Edge mode forces all pages to be opened in standards mode, regardless of the version of Internet Explorer, you might be tempted to use this for all pages viewed with Internet Explorer. Don’t do this, as the X-UA-Compatible header is only supported starting with Windows Internet Explorer 8. Edge mode was introduced in Internet Explorer 8 and has been available in each subsequent release. Note that the features supported by edge mode are limited to those supported by the specific version of the browser rendering the content. Caching headers are unreliable in meta elements; for one,any web proxies between the site and the user will completely ignorethem.
As we announced in August 2013, we are deprecating document modes as of IE11. With our latest platform updates, the need for legacy document modes is primarily limited to Enterprise legacy web apps. IE will still honor document modes served by intranet sites, sites on the Compatibility View list, and when used with Enterprise Mode only. Starting with IE11, document modes are deprecated and should no longer be used, except on a temporary basis. Make sure to update sites that rely on legacy features and document modes to reflect modern standards. Putting caching instructions into meta tags is not a good idea, because although browsers may read them, proxies won’t.
You should always use a real HTTP header for headers such asCache-Control and Pragma. As others have said, HTTP headers are the best way to control caches, because these are observed by all caches – tags are only observed by browser caches. With the changes in Microsoft Edge to no longer support document modes in most cases, Microsoft has a tool to scan your site to check and see if it has code that is not compatible with Edge.
As more and more web developers wanted to use the new web standards features, more and more websites were more supported by Firefox than IE. In the fast-paced internet era, delivering up-to-date content to users is crucial. Browser caching, while speeding up website loading, poses challenges in serving recent updates. Fortunately, developers can leverage meta HTML tags to control caching behaviour, ensuring users receive the latest content promptly. This article explores the significance of browser caching and demonstrates the use of meta HTML tags to enhance web speed.
At most, one could haveone of each http-equiv declarations; pragma, cache-control andexpires. These are completely outdated when using modern up to date browsers.After IE9 anyway. Chrome and Firefox specifically does not work with these as you would expect, if at all.
See answer here: How to control web page caching, across all browsers?
This feature is well established and works across many devices and browser versions. Through the use of the expiration ate in the past, the browser should regard the file as expired and not cache it. Accordingly, the content has to be downloaded each time the page is loaded or refreshed. Find centralized, trusted content and collaborate around the technologies you use most. Yes, I know that I’m late to the party, but I just had some issues and discussions, and in the end my boss had me remove the X-UA-Compatible tag remove from all documents I’ve been working on. Doing this is just like adding any other IE conditional statement and only works for IE and no other browsers will be affected.
http-equiv attribute
- As others have said, HTTP headers are the best way to control caches, because these are observed by all caches – tags are only observed by browser caches.
- However, cacheing headers are unreliable in meta elements; for one, any web proxies between the site and the user will completely ignore them.
- In the fast-paced internet era, delivering up-to-date content to users is crucial.
- Note that looking at the DOCTYPE is the very last fallback for deciding the document mode.
If you are using the X-UA-Compatible META tag you want to place it as close to the top of the page’s HEAD as possible. Internet Explorer begins interpreting markup using the latest version. When Internet Explorer encounters the X-UA-Compatible META tag it starts over using the designated version’s engine. This is a performance hit because the browser must stop and restart analyzing the content. The browser cache should not be used and when you load the page or refresh it, the content should be served from the server, not from the cache. That said, I wouldn’t be surprised if browsers still observe for pages with the HTML5 doctype.
Since I can not add a comment to the marked answer I will just post this here. DOCTYPE alone cannot do that; you will end up in one of the Compatibility View modes in these cases regardless of DOCTYPE. This tag has been strongly recommended by the Bootstrap team since at least 2014, and Bootlint, the linter authored by the twbs team continues to throw a warning when the tag is omitted. The linter distinguishes between warnings and errors, and as such the severity of omitting this tag may be considered minor.
The X-UA-Compatible … must appear in the header of the webpage (the HEAD section) before all other elements except for the title element and other meta elements. These two rules are simplified but they are easy to remember and to verify. Despite MSDN docs stating you can put title and other meta tags before this one, I would not recommend to do so. And IE v6 was considered as a de facto standard (80% to 97% market share in 2003, 2004, 2005 and 2006 for IE6 only, more market share with all IE versions). The list is just examples of different techniques, it’s not for directinsertion. If copied, the second would overwrite the first and thefourth would overwrite the third because of the http-equivdeclarations AND fail with the W3C validator.
If you currently use the x-ua-compatible header to target a legacy document mode, it’s possible your site won’t reflect the best experience available with IE11. The X-UA-Compatible meta tag allows web authors to choose what version of Internet Explorer the page should be rendered as. Microsoft Edge, the browser that replaced IE11, only honors the X-UA-Compatible meta tag in certain circumstances. If there is no difference, I suppose I can just ignore the X-UA-Compatible meta header, since I just want it to be rendered in most standard mode in all IE versions. However, at this time, Mozilla started Firefox development respecting as much as possible all the web standards (other browser were implemented to render pages as done by IE6).