[英]IIS Update reset browser
I wanted to know if there is a way to reset browser cache once I update web server with new code?我想知道用新代码更新 web 服务器后是否有办法重置浏览器缓存? I have JavaScript that is I want to make sure they user has the most update version.
我有 JavaScript,我想确保他们的用户拥有最新版本。
In IIS you can change the Content Expiry Header to force the client to get the latest versions of the files.在 IIS 中,您可以更改内容到期 Header 以强制客户端获取文件的最新版本。
Open IIS Manager, select your site.打开 IIS 经理,select 您的站点。
From the middle pane double click on the HTTP Response Headers .在中间窗格中双击HTTP Response Headers 。
3)On the HTTP Response Headers page, in the Actions pane, click Set Common Headers. 3) 在 HTTP Response Headers 页面上,在 Actions 窗格中,单击 Set Common Headers。
4)In the Set Common HTTP Response Headers dialog box, select the Expire Web content checkbox and select one of the following options: 4)In the Set Common HTTP Response Headers dialog box, select the Expire Web content checkbox and select one of the following options:
Select Immediately if you want the content to expire immediately after it is sent in a response. Select如果您希望内容在响应中发送后立即过期,则立即生效。
Select After if you want the content to expire periodically. Select如果您希望内容定期过期。 Then, in the corresponding boxes, type an integer and select a time interval at which content expires.
然后,在相应的框中,键入 integer 和 select 内容到期的时间间隔。 For example, type 1 and select Days if you want the content to expire daily.
例如,如果您希望内容每天过期,请键入 1 和 select Days。
Select On (in Coordinated Universal Time (UTC)) if you want the content to expire on a specific day and at a specific time. Select 如果您希望内容在特定日期和特定时间到期,则开启(采用协调世界时 (UTC))。 Then, in the corresponding boxes, select a date and time at which the content expires.
然后,在相应的框中,select 内容到期的日期和时间。
If you have access to the source code all modern browsers will treat resources such as a CSS, Javascript as new versions if you append a query string to them which is unique.如果您可以访问源代码,那么所有现代浏览器都会将 CSS、Javascript 等资源视为新版本,如果您对它们提供一个唯一的查询字符串 append。
Eg例如
http://example.com/test.js?v=1.1 http://example.com/test.js?v=1.1
The actual content of the query string doesn't matter as long as it's unique, however, most developers will tend to use v for version and then just set it to be the build number.查询字符串的实际内容并不重要,只要它是唯一的,然而,大多数开发人员倾向于使用 v 表示版本,然后将其设置为内部版本号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.