I have a bookmark that I use to 'zap colours' from websites:

javascript:(function(){var%20newSS,%20styles='*%20{%20background:%20white%20!%20important;%20color:%20black%20!important%20}%20:link,%20:link%20*%20{%20color:%20#0000EE%20!important%20}%20:visited,%20:visited%20*%20{%20color:%20#551A8B%20!important%20}';%20if(document.createStyleSheet)%20{%20document.createStyleSheet("javascript:'"+styles+"'");%20}%20else%20{%20newSS=document.createElement('link');%20newSS.rel='stylesheet';%20newSS.href='data:text/css,'+escape(styles);%20document.getElementsByTagName("head")[0].appendChild(newSS);%20}%20})();

and I'd really like to make it an actual button on the toolbar in firefox (for instance, on the right of the 'help' button). I know it's easy to move it onto the bookmarks toolbar etc, but I like to have the bookmark toolbar hidden, so would rather have an actual button in firefox for this, and maybe some other bookmarks if it's easy!

link|improve this question

43% accept rate
I didn't want to edit your questions as this might apply to plain bookmarks as well, but just in case you don't know: JavaScript bookmarks are often referred to as "bookmarklets". (My new favourite: The Printliminator at css-tricks.com/examples/ThePrintliminator) – Arjan Nov 4 '09 at 14:11
Thanks for your comment - I'll be looking for some more interesting booklets in the future! I am currently trying to use the solution below, but not having much look at the moment – kevyn Nov 4 '09 at 18:24
feedback

4 Answers

You can use an extension to create Custom Buttons.

alt text

You can add text to the button if you wish, use it to launch a specific website or execute code. Initialization Code is executed when the browser is launched and the button is first created.

Usage is simple.

  • Right-click an empty space in your toolbar and select the new option called Add new button...
  • You get to see the dialog above.
  • Once done, the button is created. All you need is to now add it to wherever you like through the Customize option of the toolbar context menu.

alt text

link|improve this answer
Thank you for this - I have installed it, and tried to paste the javascript into the code section, and also tried it in the URL section, but neither seem to work. I have the button on my toolbar, but at the moment it does nothing! my code is in my OP – kevyn Nov 4 '09 at 18:22
I'm not familiar with javascript. But I suspect you need to edit your snippet as to remove "javascript:" and possibly also "function()". Essentially alter it to be executed from the code box which, I believe, internally uses a evaluate function. – A Dwarf Nov 4 '09 at 18:39
Sadly I tried removing both of those, and neither solution worked. I also tried to add it as a URL (after all it is only a URL in my bookmarks) but that didn't work either – kevyn Nov 5 '09 at 11:39
2  
If you follow @Inrbob's instructions of placing the bookmarklet code inside loadURI("BOOKMARKLET HERE"); it works perfectly! – Acorn Mar 12 '11 at 1:12
feedback

This may not be exactly answering your question,
But, if you want to save the bookmark toolbar space (and not just hide and unhide it at times),
you can reduce the bookmark toolbar content and move it completely besides the 'Help' button.
This way you are done with just two 'bars' under the firefox title.
The Menu bar and the Address bar... Does that work for you?

To get this done,

  1. right-click in the space besides the Help button
  2. select 'customize...'
  3. drag the bookmarks toolbar from its position to the new one besides 'Help'
  4. end customization with the 'Done' button
  5. Now, if your bookmark has a good icon, you can even delete its name string and
    make it look quite like a button there...
link|improve this answer
Thanks for the suggestion, but I do want to keep my bookmarks toolbar which has several items on it hidden, but need a 2nd bookmark toolbar really! – kevyn Nov 6 '09 at 11:26
feedback

I realise this is very very old - but I came across it today while looking for an answer to this question. Use the custom bookmark tool as recommended above and then add the line of javascript that appears in your bookmarklet where URL appears in the code below:

loadURI ("*URL*");
link|improve this answer
This work perfectly! – Acorn Mar 12 '11 at 1:09
wooo! glad it helped :) – lnrbob Mar 12 '11 at 8:06
feedback

The suggested extension was supposed to replace (and work similarly to...) CustomButtons2. It's site was a mess and it was last updated a year ago. No such functionality exists for current versions of Firefox - and it is sorely needed.

A comment from someone who recently tried that extension: "It updated and now nothing works. (last update) Monday May 14, 2012 FF version 12. no one button will load and nothing shows to add button on Toolbar."

I have found a way to make bookmark buttons, but have found no way to make javascript bookmarklets work in a toolbar button format yet.

If interested, see my post for details: Here

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.