# Viewing favicon through javascript

**URL:** https://forum.kirupa.com/t/viewing-favicon-through-javascript/172129
**Category:** web dev
**Created:** [December 11, 2005, 8:34pm UTC](https://forum.kirupa.com/t/viewing-favicon-through-javascript/172129 "2005-12-11T20:34:43Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![F\_zzyDice](https://avatars.discourse-cdn.com/v4/letter/f/91b2a8/32.png) [@F\_zzyDice](https://forum.kirupa.com/u/F_zzyDice)
#### Post date: [December 11, 2005, 8:34pm UTC](https://forum.kirupa.com/t/viewing-favicon-through-javascript/172129/1 "2005-12-11T20:34:43Z")

</div>

Hello,  
I’m trying to figure out how to display a favicon on a page with the source of the favicon inside a frame called “win”. Here is my code:

```auto

Javascript:
 
if (document.getElementById) {
favicon = new Image(16, 16);
document.getElementById('favicon').src = win.location.href + '/favicon.ico';
}
 
HTML:
 
<img src="about:blank" border="0" alt="Icon" name="favicon" id="favicon">

```

so if the framed page was [google.com](http://google.com) the path to the favicon would be [google.com/favicon.ico](http://google.com/favicon.ico) in the image tag  
Thanks for the help :rambo:
