How to remove Microsoft Edge's cache using PHP or Javascript?

走远了吗. 提交于 2019-12-06 13:37:52
user400654

A "quick fix" would be to use the cache: false option of the $.ajax method, but this really isn't the right way to solve this problem if you have control of the server. Instead, you shoudl have php return a no-cache header on services you don't want cached, and a cache header on services you do want cached.

header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1.
header("Pragma: no-cache"); // HTTP 1.0.
header("Expires: 0"); // Proxies.

The above code was taken from BalusC's answer over here: How to control web page caching, across all browsers?

Otherwise, you should have an htaccess that specifies which files should be cached such as static assets that don't change often (.html, .js, .css, etc)

mr_schmiggles

You can check some of the answers here. I don't think the browser will allow you to clear the cache directly through javascript. There are workarounds that may be able to solve your problem, though.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!