Prevent browser caching of AJAX call result

后端 未结 21 1535
醉酒成梦
醉酒成梦 2020-11-22 04:47

It looks like if I load dynamic content using $.get(), the result is cached in browser.

Adding some random string in QueryString seems to solve this iss

21条回答
  •  滥情空心
    2020-11-22 05:03

    Internet Explorer’s Ajax Caching: What Are YOU Going To Do About It? suggests three approaches:

    1. Add a cache busting token to the query string, like ?date=[timestamp]. In jQuery and YUI you can tell them to do this automatically.
    2. Use POST instead of a GET
    3. Send a HTTP response header that specifically forbids browsers to cache it

提交回复
热议问题