每次从服务器加载index.html,而不是从缓存中加载 [英] Load index.html every time from the server and NOT from cache

查看:142
本文介绍了每次从服务器加载index.html,而不是从缓存中加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个托管在特定服务器上的网页 index.html 。我已将 example.com 指向 example.com/index.html 。因此,当我在index.html中进行更改并保存它,然后尝试打开example.com时,更改不会反映出来。

然后我手动刷新页面,因为它加载新的副本而不是缓存,它可以正常工作。但我不能要求我的客户这样做,他们希望一切都是完美的。所以我的问题是,是否有一种技巧或技巧来说明如何从服务器而不是从缓存中加载文件?



PS:我知道诡计的CSS,JS和图像文件,即附加?v = 1 但不知道如何做index.html。



任何帮助将不胜感激。谢谢!

解决方案

by this:

 < meta http-equiv =expirescontent =0> 

将内容设置为0会告诉浏览器始终从Web服务器加载页面。

I have a webpage index.html hosted on a particular server. I have pointed example.com to example.com/index.html. So when I make changes in index.html and save it, and then try to open example.com, the changes are not reflected. Reason that the webpages are being cached.

Then I manually refresh the page and since it loads the fresh copies and not from cache, it works fine. But I cannot ask my client to do so, and they want everything to be perfect. So my question is that is there a trick or technique as to how I can make the file load every time from the server and not from cache?

P.S: I know the trick for CSS, JS and images files, i.e. appending ?v=1 but don't know how to do it for index.html.

Any help would be appreciated. Thanks!

解决方案

by this:

<meta http-equiv="expires" content="0">

Setting the content to "0" tells the browsers to always load the page from the web server.

这篇关于每次从服务器加载index.html,而不是从缓存中加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆