Changing website favicon dynamically

前端 未结 15 1320
温柔的废话
温柔的废话 2020-11-22 02:17

I have a web application that\'s branded according to the user that\'s currently logged in. I\'d like to change the favicon of the page to be the logo of the private label,

15条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 02:27

    According to WikiPedia, you can specify which favicon file to load using the link tag in the head section, with a parameter of rel="icon".

    For example:

     
    

    I imagine if you wanted to write some dynamic content for that call, you would have access to cookies so you could retrieve your session information that way and present appropriate content.

    You may fall foul of file formats (IE reportedly only supports it's .ICO format, whilst most everyone else supports PNG and GIF images) and possibly caching issues, both on the browser and through proxies. This would be because of the original itention of favicon, specifically, for marking a bookmark with a site's mini-logo.

提交回复
热议问题