Results 1 to 2 of 2

Thread: Website favicon

  1. #1
    Join Date
    Jan 2011
    Posts
    23

    Website favicon

    Hey, im trying to get the favicon of most sites, im working with the following code:
    Code:
    <a href='javascript:(function(){links = document.getElementsByTagName("link"); wHref=window.location.protocol + "//" + window.location.hostname + "/favicon.ico"; for(i=0; i
    <links.length; i++){s=links[i].rel; if(s.indexOf("icon") != -1){ wHref = links[i].href }; }; w = window.open(wHref, "Shortcut icon", "width=200, height=200"); })();'>Get Favicon</a>
    this code only gets the favicon of the site you are on, how can i make it so that it could be for any site.

  2. #2
    Join Date
    Mar 2011
    Posts
    16
    Read and parse the html code, practically rewrite the above javascript code in the the language of your choice. Javascript is not appropriate because it runs on the browser side. You can choose php/ java / c#/ python/ ...

    You should also check the root of the domain if no reference is found in html. Something like this: "http://domain.com/favicon.ico";

Similar Threads

  1. Favicon IE8
    By Magiccupcake in forum General Questions
    Replies: 1
    Last Post: 23 Jul 2009, 04:23 PM
  2. Favicon not displaying...
    By mickapoo in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 28 Jan 2007, 01:36 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •