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

I've currently started on a project including AJAX, and I ran into a problem. When using Microsoft

I've currently started on a project including AJAX, and I ran into a problem. When using Microsoft Edge (and Internet Explorer) it won't update data, unless I close the entire page and open it again, or if I open my PHP file, from which I send data through AJAX.

Does anyone no how to solve this issue using PHP and/or Javascript?

Thanks in advance

I've currently started on a project including AJAX, and I ran into a problem. When using Microsoft Edge (and Internet Explorer) it won't update data, unless I close the entire page and open it again, or if I open my PHP file, from which I send data through AJAX.

Does anyone no how to solve this issue using PHP and/or Javascript?

Thanks in advance

Share Improve this question edited Feb 6, 2017 at 23:36 Web_Designer 74.8k93 gold badges210 silver badges267 bronze badges asked Oct 8, 2015 at 14:47 Magnus VestergaardMagnus Vestergaard 882 silver badges13 bronze badges 17
  • What caching header(s) is your server sending with the response? – Kevin B Commented Oct 8, 2015 at 15:04
  • @KevinB It just keeps sending the excact same data through the Ajax, though in Chrome and Firefox the data gets updated, and I'm not exactly bit 99% it's the cache – Magnus Vestergaard Commented Oct 8, 2015 at 15:10
  • What caching header(s) is your server sending with the response? – Kevin B Commented Oct 8, 2015 at 15:10
  • I'm not sure I now what you mean, sry – Magnus Vestergaard Commented Oct 8, 2015 at 17:42
  • 1 you can find answer here : stackoverflow./questions/36435567/… – S.Mohamed Mahdi Ahmadian zadeh Commented Feb 7, 2017 at 5:45
 |  Show 12 more ments

2 Answers 2

Reset to default 6

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)

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745538583a4632020.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信