缓存清单和查询字符串 [英] Cache manifest and query strings

查看:113
本文介绍了缓存清单和查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调查使用缓存清单。如果我有一个清单,比如:

  CACHE MANIFEST 
stylesheets / style.css

在页面中,我有一个CSS元素引用 stylesheets / style.css?v = 123



style.css 文件是从缓存还是远程检索?

解决方案

缓存清单中的URL和您要调用的URL必须匹配(包括查询)。 b

在您的示例中:

CACHE MANIFEST stylesheets / style.css



in HTML:stylesheets / style.css?v = 123



浏览器总是尝试从服务器获取CSS文件,因为只有无查询CSS文件被缓存本地。在缓存中使用stylesheets / style.css就足够了。


I am investigating using a cache manifest. If I have a manifest such as:

CACHE MANIFEST
stylesheets/style.css

And in the page I have a CSS element referencing stylesheets/style.css?v=123.

Will the style.css file be retrieved from the cache or remotely?

解决方案

The URL in the cache manifest and the URL you're calling must match (INCLUDING the query).

In your example:

CACHE MANIFEST stylesheets/style.css

in HTML: stylesheets/style.css?v=123

The browser will ALWAYS try to fetch the CSS file from the server, since only the query-less CSS file is cached locally. Use of stylesheets/style.css in cache is sufficient.

这篇关于缓存清单和查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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