Sokco
19 Mar 2011, 04:03 PM
Hey, im trying to get the favicon of most sites, im working with the following 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.
<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.