角模板prevent浏览器缓存缓存、浏览器、模板、prevent

2023-09-13 05:06:39 作者:Dream ×又一梦。

我一直在研究背部和第四在这个问题上,这是很简单的:现代浏览器(铬/ FF)的缓存的东西,其中包括HTML页面。 当你发布一个新版本,角里获得这些模板。然而,由于浏览器服务于这些网页的高速缓存版本,而不是新的更新版本。

I've been researching back and fourth on this issue, which is quite simple: Modern browsers (chrome/ FF) are caching stuff, html pages among others. When you release a new version, angular GETs these templates. However since the browser serve a cache version of these pages and not the new updated version.

我读过关于如何实现这一目标约2000条..元标签中没有为我工作。(例如:Using <&荟萃GT;标签关闭缓存在所有浏览器)的作品中加入一些参数值 http://bla.com?random手动管理文件的版本唯一= 39399339 。然而,这实在是烦人,非常艰难维持,如果只是有时会需要(主要版本之间)清缓存。

I've read about 2000 article on how to achieve this.. None of the "meta" tags worked for me.. (for instance: Using <meta> tags to turn off caching in all browsers?) The only thing that works is manually manage the versions of the file by adding some param value http://bla.com?random=39399339. However this is really annoying and extremely tough to maintain if "clear caching" is only sometimes needed (mainly between versions).

是否有机会浏览器并没有提供一个简单的,可控的方式来手动清除缓存。无论是在服务器或客户端方式?

Is there any chance browsers does not provide a simple, controlled way to manually "clear cache". Either on server or client way?

P.S。角模板,使得它更严厉的管理。

P.S. Angular template makes it even tougher to manage.

推荐答案

这是有这么多答案的问题,而这取决于您的服务器上,等等...

This is a question with so many answers, and it depends on your server, etc...

通常HTML文件没有缓存 AngularJS后的第一次打电话给他们,使用$ templateCache服务(在应用程序运行)缓存模板您可以使用html2js与咕噜或一饮而尽编译你的模板在一个JavaScript文件有很多人不靠客户端缓存,ETag的,等等,并添加一个版本,哈希,后缀和/或preFIX静态资源URI
 
精彩推荐
图片推荐