开发者

javascript bookmark icon

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 si开发者_运维技巧te, 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


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.


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">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜