即使服务器离线,浏览器也能加载 silverlight 页面/xap
即使服务器出现故障,是否可以强制浏览器重新加载 Silverlight 应用程序(基本上是 .aspx 和 .xap 文件)?即浏览器无法访问。就像永远设置缓存一样。我尝试了不同的缓存控制和过期标头,但似乎没有什么区别,仍然是 200 或 304 请求。
换句话说,我希望浏览器加载 .xap 一次,然后不再发送对其的请求,始终从缓存加载 - 从不意味着甚至 304 都不会。
换句话说,是否有可能使浏览器在获得页面和相关内容后,从缓存中使用它们,而根本不联系服务器?
Is it possible to force browser to reload a Silverlight application - basically .aspx and .xap files - even if the server goes down? I.e. not accessible to the browser. Like setting caching forever. I tried different cache-control and expires headers but it doesn't seem to make a difference, it's still either 200 or 304 requests.
In other words, I want browser to load .xap once and then never send requests for it again, always loading from cache - never means not even 304s.
In even other words, is it possible to make browsers, once they got page and related content, to use them from cache and not contact server at all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您经常使用“浏览器”这个词,但您没有指定是哪个浏览器。大多数浏览器都有“离线工作”模式,在这种模式下,它们将尝试在不访问源服务器的情况下工作。我有一种感觉,这不是你所说的。
我的猜测是,您指的是无法说服 IE 不要从服务器获取资源,即使随其发送的缓存控制标头表示应该仍然是新鲜的。默认情况下,IE 在会话期间首次访问缓存内容时不信任缓存内容。
您可以通过进入“Internet 选项”并打开“浏览历史记录设置”来更改此行为。默认情况下,“检查页面的较新版本”设置为“自动”。将其更改为“从不”。该设置有点误导,它的真正含义是信任服务器缓存标头,因此不要尝试重新获取缓存表示仍然新鲜的资源。
当然,这也有一些严重的缺点。它的设置会影响所有区域中的所有站点,并且是用户必须对其客户端计算机执行的操作。
You use the word "browser" quite a lot but you haven't specified which browser. Most browser have a "work offline" mode in which they will attempt to work without accessing the source server. I'be got a feeling that is not what you are refering to.
My guess though is you are refering to an inability to convince IE not to fetch a resource from the server even though the cache-control header send with it says ought to still be fresh. By default IE does not trust cache content the first time it is accessed during a session.
You can change this behaviour by going into Internet Options and opening the Browsing History Settings. By default the "Check for newer version of pages" is set to "Automatic". Change it "Never". That setting is a bit misleading, what it really means is trust the servers cache headers so don't try to re-fetch a resource which the cache says is still fresh.
Of course there are some serious downsides to this. Its a setting which affects all sites in all zones and its something the user has to do to their client machine.