I've formatted both of these for easy reading, in case some Javascript geniuses can help us.
Axel's version (which ignores selected text):
javascript: s=document.getSelection(); for(i=0;i<frames.length;i++){ s=frames[i].document.getSelection(); if(s)break; } if(!s)void(s=prompt('Entersearch terms forWikipedia','')); wikiw=open('http://wikipedia.com/%27+(s?%27search.fcgi?request=%27+escape(s):'')); wikiw.focus();
My version (which works on Netscape for Linux, not sure about others yet):
javascript: q=document.getSelection() ;for(i=0;i<frames.length;i++){ q=frames[i].document.getSelection(); if(q)break; } if(!q)void(q=prompt('Enter text to search using Wikipedia. You can also highlight a word on this web page before clicking Wikipedia.','')); if(q)location.href='http://www.wikipedia.com/search.fcgi?client=magic_button&request=%27+esc...)
---------
My version doesn't pop a new window for Wikipedia -- it just takes you there. His version pops a new window and gives it focus. I prefer mine, but perhaps other people would prefer his?
Also, mine works, but I'm not sure why his doesn't.