UI_Dev
UI_Dev

Reputation: 3427

How to clear cache programatically in html?

I have tried researching to clear cache of my website from meta tag. But none of them are working.

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate, max-age=0" />
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Expires" content="Tue, 01 Jan 2000 00:00:00 GMT">

tried this one, but I am getting cache in firefox.

To see cache: Type about:cache or about:cache?storage=disk&context= in address bar.

I tried the below one, its working, but I need to do this programatically.

Enter "about:config" into the Firefox address bar and set:

  network.http.use-cache = false

Any working solutions in meta tag or Javascript or HTML5 manifest will be highly appreciated.

Upvotes: 0

Views: 240

Answers (1)

Quentin
Quentin

Reputation: 944442

meta tag

No. The http-equiv attribute supports a number of values, none of which touch caching.

Javascript

No. JavaScript is not provided with any APIs that let you override caching.

HTML5 manifest

No. The manifest lets you mark files to be hard cached for offline use. It provides no mechanism to reducing caching.


If you want to tell the browser not to cache something then you have to do it with real HTTP headers.

Upvotes: 1

Related Questions