我可以每天更换一个图标吗? [英] Can I change a favicon daily

查看:83
本文介绍了我可以每天更换一个图标吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个日历应用程序站点上供内部使用.它基本上是Google日历页面的包装器,但是顶部会有一些额外的内容,而日历则位于下面.我想做的一种有趣"的事情是每天更换页面的图标-我使用的是一种日历图像,我希望它显示当天的图像.这可能吗?

I'm working on a calendar app site for internal use here. It's basically a wrapper for a google calendar page, but there will be some extra stuff at the top with the calendar down below. One kind of "fun" thing I'd like to do with this is change up the favicon for the page each day - I'm using a kind of calendar image and I'd like it to show the image for the current day. Is this possible?

我正在使用asp.net网络表单,但我实际上是在问一个较低级别的问题-是否有可能使这项工作奏效,或者浏览器会过于激进地对其进行缓存?

I'm using asp.net webforms, but I'm really asking the question at a lower level - is it possible to make this work or will browsers cache it too aggressively?

推荐答案

从理论上讲,您可以.实际上,浏览器确实非常积极地对其进行缓存.最好的选择是将favicon文件放在根文件夹之外(以防止自动查找),并在<head>中手动定义它,以及在favicon URL的查询字符串中每日更改时间戳.例如

In theory, you can. In practice, browsers indeed cache it very agressively. Your best bet is to place the favicon file outside the root folder (to prevent automatic lookup) and manually define it in <head> along with a daily changing timestamp in the query string of the favicon URL. E.g.

<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico?3213256">

哦,HTML页面本身也应该具有或多或少相同的缓存控制设置,否则浏览器会从缓存中请求页面本身,因此永远不会刷新收藏夹图标.

Oh, the HTML page itself should also have less or more the same cache control settings, else the browser will request the page itself from the cache and thus never refresh the favicon.

这篇关于我可以每天更换一个图标吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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