Clear browser cache with JavaScript

Question:

Is it possible to clear the cache of Firefox and Chrome browsers via JavaScript? With Internet Explorer I can already do it, but not the ones mentioned above.

Man, it didn't work, I believe the problem occurs because I save the user logged in remember-me… but the problem only occurs when I close the browser, if I click on exit it works normally.

Have you ever seen something like that?

If the user checks the check box remember, I add a cookie:

if (model.RememberMe)
 {
     Response.Cookies["SistemaLeilao"].Value = model.UserName;
     Response.Cookies["SistemaLeilao"].Expires = DateTime.Now.AddMinutes(5);
 }

When I click on exit and logoff , fillet works, but when I close the browser window without logoff everything is recorded, and that's what's bothering me.

Answer:

It's not possible, and if it were it would be a huge security hole, did you think you'd be able to clear the cache of anyone who accessed your page?

What you can do is tell the browser not to cache your page , this can be done using one of these meta tags:

<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
Scroll to Top