使用 jQuery 清除浏览器缓存

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25301436/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 11:04:27  来源:igfitidea点击:

Clear browser cache using jQuery

jquerycaching

提问by Xylon

In my mini project i'm trying to crop an already uploaded image and then show the cropped image in place of the original image in the gallery page. But after I'm done with cropping i'm shown the the original image when i'm redirected to the gallery page even refreshing the page doesn't work. I have to clear the browser's cache in order to see the cropped image. Can i clear the browser's cache using jQuery?

在我的小项目中,我试图裁剪已经上传的图像,然后在图库页面中显示裁剪后的图像代替原始图像。但是在我完成裁剪后,当我被重定向到图库页面时,我会看到原始图像,即使刷新页面也不起作用。我必须清除浏览器的缓存才能看到裁剪后的图像。我可以使用 jQuery 清除浏览器的缓存吗?

采纳答案by Aksh

Just go through this link, it is not possible to clear cache but can prevent it by using metatag "no cache" or either in http headers. but alternatively can do this by using parameters,refreashing etc. or javascript file name versioning so browser will download it always.

只需通过此链接,无法清除缓存,但可以通过使用元标记“无缓存”或在 http 标头中阻止它。但也可以通过使用参数、刷新等或 javascript 文件名版本控制来做到这一点,以便浏览器始终下载它。

http://www.sitepoint.com/forums/showthread.php?866717-How-to-force-the-user-s-browser-to-clear-its-cache

http://www.sitepoint.com/forums/showthread.php?866717-How-to-force-the-user-s-browser-to-clear-its-cache

http://www.sitepoint.com/caching-php-performance/

http://www.sitepoint.com/caching-php-performance/