How to use the Expires” Meta Tag In HTML

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.

Example: To demonsrtate using the “Expires” Meta Tag to disable browser caching with the meta HTML tags.

HTML
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="Expires" content="Thu, 01 Jan 1970 00:00:00 GMT">
    <title>Disable Browser Caching</title>
</head>

<body>
    <h1>Hello World!</h1>
    <p>This page should not be cached by the browser.</p>
</body>

</html>

Output:

Disable browser caching Using Expires Meta Tag

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.



Disable Browser Caching with Meta HTML Tags

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.

Table of Content

  • Using the Cache-Control Meta Tag
  • Using the Pragma Meta Tag
  • Using the Expires” Meta Tag

Similar Reads

Using the Cache-Control Meta Tag

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

Using the Pragma Meta Tag

This is similar to the cache control meta tag having a no-cache attribute which makes the browser not cache the page. Hence the content is fetched afresh from the server when one visits a page or refreshes the same....

Using the Expires” Meta Tag

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