什么是'?'在Css链接? [英] What does '?' do in a Css link?

查看:107
本文介绍了什么是'?'在Css链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在浏览我最喜欢的网站的HTML ... ...我在标记中看到了这个:

I was browsing the html of my favorite site...ahem...and I saw this in the markup:

<link href="/Content/all.min.css?d=20090107" rel="stylesheet" type="text/css" />

d = 20090107做什么?我假设它是某种日期,但我不知道为什么它在文件的路径。任何想法?

what does "?d=20090107" do? I'm assuming it's a date of some kind, but I'm not sure why it's in the path to the file. Any ideas?

推荐答案

这是为文件名添加一些唯一性,以便当他们更改CSS文件时,更改额外的位以完全确保每个客户端将重新加载CSS,而不是使用缓存版本。

That is there to add some uniqueness to the filename, so that when they change the CSS file, they can change the extra bit to be totally sure that every client will reload the CSS rather than use a cached version.

Web服务器将忽略参数和服务/ Content / all。 min.css通常

The webserver will ignore the parameter and serve /Content/all.min.css normally

注意:虽然是可能的 CSS是动态生成的,这是确保重新加载的常见习语,参数是一个日期,很有可能。

Note: While it's possible the CSS is dynamically generated, this is a common idiom for ensuring a reload, and given the parameter is a date, it seems quite likely.

编辑: Podcast 38 提到这个...

Podcast 38 mentioned this...


使用Expires或
Cache-Control Header,因为我们启动了
。这会节省浏览器
在不经常时变化
时更改项目,例如图片,
javascript或css。缺点是
,当你实际更改
这些文件,你必须记住
更改文件名。 我们的
构建过程的一部分现在标记这些文件
版本号,因此我们不再需要
手动地记住这样做。

这篇关于什么是'?'在Css链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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