Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I detect whether a browser's Bookmarks toolbar is enabled with JavaScript?

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?

like image 741
Will Martin Avatar asked Dec 12 '25 15:12

Will Martin


2 Answers

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).

like image 97
James Hill Avatar answered Dec 14 '25 05:12

James Hill


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.

like image 37
qw3n Avatar answered Dec 14 '25 04:12

qw3n