Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
356 views
in Technique[技术] by (71.8m points)

favicon - 如何强制网站图标刷新?(How do I force a favicon refresh?)

I have a Grails application running locally using its own tomcat and I have just changed the favicon for a new one.

(我有一个Grails应用程序,它使用自己的tomcat在本地运行,而我刚刚将图标图标更改为一个新图标。)

Problem is that I can not see it in any browser.

(问题是我无法在任何浏览器中看到它。)

The old favicon shows up or I get no favicon at all, but not my new one.

(出现旧的收藏夹图标,或者我什么都没有得到,但是我的新收藏夹没有。)

I do not think this is a Grails issue per se, more an issue with favicons.

(我认为这本身不是Grails的问题,更多的是网站图标的问题。)

What is supposed to happen with favicons?

(网站图标应该发生什么?)

How are they supposed to work?

(他们应该如何工作?)

I have numerous bookmarks in my browser which have the wrong icons and they never seem to get refreshed.

(我的浏览器中有很多书签,这些书签的图标错误,它们似乎从未刷新过。)

How do I force the server/browser to stop caching them?

(如何强制服务器/浏览器停止缓存它们?)

It seems pretty silly to always cache them given they are normally only 16x16.

(鉴于通常只有16x16,总是缓存它们似乎很愚蠢。)

Why not just upload them with every visit to the page?

(为什么不随页面访问一起上传它们呢?)

It is not exactly a huge overhead.

(这并不是一个巨大的开销。)

  ask by Simon translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

To refresh your site's favicon you can force browsers to download a new version using the link tag and a querystring on your filename.

(要刷新您网站的收藏夹图标,您可以强制浏览器使用链接标签和文件名上的查询字符串下载新版本。)

This is especially helpful in production environments to make sure your users get the update.

(这在生产环境中特别有用,可确保您的用户获得更新。)

<link rel="icon" href="http://www.yoursite.com/favicon.ico?v=2" />

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...