New/update favicon per page

你离开我真会死。 提交于 2019-12-03 07:12:53
Smeltdown

You're on the right track with using the link rel's on every page, but the trick to forcing the favicon refresh is to append a number at the end of the icon file as a parameter that's always changing (time is the safest bet).

Example with php:

<?php
    echo '<link rel="shortcut icon" href="http://www.yoursite.com/favicon.ico?t=' . time() . '" />';
?>

Doing this makes the browser think the file is new every time it sees it, thus avoiding the caching issue. I hope this points you in the right direction!

You can have a different favicon per page. You'll just need to add the following code to each HTML file:

<link rel="shortcut icon" href="/YourIcon.ico" type="image/x-icon" />
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!