How can I get a web site's favicon?

前端 未结 14 2077
旧巷少年郎
旧巷少年郎 2020-12-22 15:28

Simple enough question: I\'ve created a small app that is basically just a favourites that sits in my system tray so that I can open often-used sites/folders/files from the

14条回答
  •  囚心锁ツ
    2020-12-22 15:57

    You can get the favicon URL from the website's HTML.

    Here is the favicon element:

    
    

    You should use a regular expression here. If no tag found, look for favicon.ico in the site root directory. If nothing found, the site does not have a favicon.

提交回复
热议问题