Disable Browser Caching with Meta HTML Tags

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.

At most, how to use trello for software development 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.

Alternate of http-equiv = “pragma” and http-equiv = “cache-control” in meta tags

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.

Using the Cache-Control Meta Tag

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.

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.

Code Editor (Try it)

For that reason, they are invalid and you should send caching instructions as real HTTP headers. Tip If you want all supported versions of Internet Explorer to open your pages in standards mode, use the HTML5 document type declaration, as shown in the earlier example. Starting with IE11, edge mode is the preferred document mode; it represents the highest support for modern standards available to the browser. Edge most is most useful for regularly maintained websites that are routinely tested for interoperability between multiple browsers, including Internet Explorer. If you must have completely valid code then consider doing this on the server level by setting HTTP header.

Answers

As a note, Microsoft says, If both of these instructions are sent (meta and HTTP), the developer’s preference (meta element) takes precedence over the web server setting (HTTP header). See olibre’s answer or bitinn’s answer for more details on how to set an HTTP header. However, cacheing headers are unreliable in meta elements; for one, any web proxies between the site and the user will completely ignore them. You should always use a real HTTP header for headers such as Cache-Control and Pragma. Use the following value to display the webpage in edge mode, which is the highest standards mode supported by Internet Explorer, from Internet Explorer 6 through IE11.

http-equiv attribute

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.

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, 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.

How to use Meta Tag to redirect an HTML page?

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.

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).

Therefore many many sites were IE6 compliant only, and as IE was not compliant with web standard, all these web sites was not well rendered on standards compliant browsers. Though some browsers may still support it, it is in the process of being dropped. The difference is that if you only specify the DOCTYPE, IE’s Compatibility View Settings take precedence. By default these settings force all intranet sites into Compatibility View regardless of DOCTYPE.

This output is unlike the common feed of traditional programming output in the sense that it cannot be seen in reality. There instead, the output though is seen in the actions of the browser’s caching mechanism when you visit the page.

Leave a comment

Your email address will not be published. Required fields are marked *