3

I have a site which offers a useful bookmark link that contains javascript only as opposed to a link to a web page. eg URL:"javascript:(function(){.....})();" The icon that appears in the bookmarks bar is the default blank paper image.

Is there a way of forcing it to have an icon of my choice, eg the favicon.ico of my site, when someone drags the link to their bookmarks bar? (eg like when your bookmark is a standatd url such as URL:"www.mysite.com")

Many thanks for you time!
jJ

Swizec Teller
  • 2,322
  • 1
  • 19
  • 24
fabric
  • 31
  • 3
  • possible duplicate http://stackoverflow.com/questions/521040/how-to-have-favicon-icon-set-when-bookmarklet-dragged-to-toolbar – Adam Nov 30 '10 at 22:24
  • 2
    Read http://www.tapper-ware.net/blog/?p=97 – Adam Nov 30 '10 at 22:26

2 Answers2

1

Those bookmarkes are called bookmarklets, just FYI :)

And no, there is no way to set up an icon for them. This is because the browser automatically looks for the favicon on the link the bookmark is pointing to. The way it finds this favicon is by either accessing the page itself and looking at the meta data in the HTML, or alternatively by going to domain/favicon.ico

As you can see, there is no way for the browser to perform those steps on a bunch of javascript code.

Swizec Teller
  • 2,322
  • 1
  • 19
  • 24
0

I could be wrong but I believe you have to visit the site at least once via the bookmark to have it update your bookmark with the appropriate icon. You can, though, use a link element in the header and specify an alternate icon for shortcuts.

<link rel="shortcut" HREF="/shortcut.ico">
Brad Christie
  • 100,477
  • 16
  • 156
  • 200