Script to force IE8 cache behaviour

佐手、 提交于 2019-12-13 00:09:47

问题


in IE8, there's an option on cache developer tools called "refresh always from server". Is it possible to have some javascript or similar to force this behaviour or I have to do it always manually?

I've tried

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

but the refreshing issue in my application seems to be resolved only by checking "refresh always from server" on cache options panel.

Thanks


回答1:


If you're using jQuery, you can do:

$.ajaxSetup({ cache: false });

which has solved many IE8 caching issues for me when using jquery + ajax.

Otherwise, you could use a "cache-breaker" by appending a unique number to the end of the .js uri. Like so:

http://mysite.com/myscript.js?=_11232131231323

Of course, the unique # could be a DateTime() that is unique on every page request.



来源:https://stackoverflow.com/questions/12477414/script-to-force-ie8-cache-behaviour

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