ZOMDir > Blog

Monday, 17 January 2011

Bookmarklets with icons?

Ever tried to make bookmarklets? It's very easy. For Website quality at a glance two bookmarklets where created. Both bookmarklets use the current location of the webpage you are viewing. The difference is that the first one shows the results in the same window, while the other opens a new window.

The bookmarklets have the same title because in some browsers this is the label used for the bookmarklet. The code of the bookmarklets is the following:
  1. <a href="javascript:(location.href='http://websitequality.zomdir.com/score?url='+encodeURIComponent(location.href))();" title="Website Quality">Website Quality</a> shows the website quality in the same window
  2. <a href="javascript:(function(){ window.open('http://websitequality.zomdir.com/score?url='+encodeURIComponent(location.href)); })();" title="Website Quality">Website Quality</a> shows the website quality in a new window
Bookmark icon is missing
When  you place this bookmarklets in your bookmark bar you will find out that they don't have an icon assigned. A regular page does have a favicon, so it should be possible to place this javascript code in the webpage itself. In that case the page that should be checked shouldn't be location.href but history.previous. However  the latest one always gives the value undefined due to security reasons.

Tips for creating a bookmark icon are welcome.


No comments:

Post a Comment