3

I have a bookmarklet, and my users are consistently clicking it instead of dragging it to their bookmarks bar first. I'd like to add an animation which would run in response to a click on the bookmarklet, say "Drag me to your bookmarks bar!" and show a nifty arrow pointing at the bar.

But that only makes sense if the browser's bookmarks bar is actually visible. Can I detect whether the bookmarks bar is visible using JavaScript?

Will Martin
  • 4,142
  • 1
  • 27
  • 38
  • That's going to be browser specific and there are no standards for that as far as I know. rather, you might consider just using a fancy little tooltip on mouseover saying drag me to your bookmarks bar. – Joseph Marikle Aug 01 '11 at 18:35
  • 1
    Although I applaud the sentiment, I'd imagine most users of bookmarklets have their bookmarks bar turned on :) – Domenic Aug 01 '11 at 18:38

2 Answers2

2

For security reasons (among others), no - this is not possible with JavaScript.

Even if a browser chose to make this information accessible to the client, it would not be a standard implementation (supported across multiple browsers).

James Hill
  • 60,353
  • 20
  • 145
  • 161
1

Put a div inside the link that holds a message when the user clicks on it use CSS to show the message. #bookmarklet:active #message{display:block;} You will need some javascript to return false on the click event.

qw3n
  • 6,236
  • 6
  • 33
  • 62
  • Or you could just have a global script that runs and searches for links with an `href` value that starts with `javascript:`, and attach said event handler. – Nightfirecat Aug 01 '11 at 18:45
  • @Nightfirecat You could, but you would want to attach a class name not an just an event handler. – qw3n Aug 01 '11 at 18:48
  • Class name, definitely; and I'll probably keep the message completely separate from the link and handle the whole thing via JavaScript to allow for fancier animation. – Will Martin Aug 01 '11 at 20:08
  • @Will Martin Of course, with CSS3 you can get some pretty fancy animations though, to bad their not implemented completely yet. – qw3n Aug 01 '11 at 20:48