Internet:Bookmarklets

From Internet Tablet Talk

Revision as of 07:17, 1 October 2008 by Iamthewalrus (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)

Although not widely known, in most browsers you can run javascripts by typing them in the url-bar. These scripts can then do anything a regular script loaded from a website can. If you bookmark such a script then it is called a bookmarklet.

Here are some examples. Just bookmark the links on those pages and you're ready to use them:


Making your own bookmarklets

If you know javascript then try making one your own. Be aware that there are some limitations:

  • all code should be on one line
  • the script should start with 'javascript:'
  • function calls should be enclosed in a void() statement, unless they are called from within another function

This bookmarklet changes the font and background color of a page:

javascript:void(main());function main(){c('body');c('td');c('div');c('p');}
function c(elname){el=document.getElementsByTagName(elname);
for(i=0;i<el.length;i++){el[i].style.background='black';el[i].style.color='white';}}

Note: The code has been divided into multiple lines to fit on the wiki page.


All times are GMT -4. The time now is 01:26 PM.