Feeling lucky? Get lucky with User Javascript.
Monday, 30. January 2006, 19:03:19
Some browsers, including Opera allows you to automatically add a prefix and postfix so that say 'foo' becomes 'www.foo.com', but it normally stops there.
Fear not. A user actually asked for this feature in one of the IRC chat channels at http://my.opera.com/chat/ and being a person who likes challenges, I couldn't not try to see if it was possible to implement using User Javascript.
User-what? You might ask. Well, it just happens to be that Opera lets you run your own scripts on virtually any page out there. You put a script in a dedicated drawer and you tell Opera to look there when loading pages. The script might be run before a page loads or after it is finished, depending on elements found in the page, the domain of the page or other criteria.
Actually most of you have already been using this kind of technique without even knowing about it. Opera does run its own set of scripts on pages that are very badly designed, or plain wrong (mostly targetted at broken browsers like MSIE). These are carefully tailored scripts made in-house at Opera so you don't need to know about them. Although the JavaScript console reports whenever such a "hot-fix" is run.
Anyway, as it is, you can stroll over to the excellent User JavaScript repository site http://userjs.org and download the auto-search-forwarder script, put it in a directory of your choice and go into:
, then select the directory in the "My JavaScript files" gadget.Preferences -> Advanced -> Content -> JavaScript Options
When typing addresses that don't exist in the address bar, you will now get redirected to Google's Feeling Lucky feature. That is namely the first hit searching on the term you typed.
Unfortunately any spaces you might have typed disappear, but you can circumvent that by using underscore, this means if you want to search for "foo bar", use "foo_bar".
Good luck
PS. For more User scripts that let you do other cool stuff, use http://userjs.org. For discussing User scripts and similar there is an own group right here on My Opera: http://my.opera.com/userjs
















Anonymous # 24. April 2006, 04:36
hi, i did download that script, and ive spent 10 mins trying to get it to work.
i created a folder in my opera 9 beta folder called userjs,
i pasted this scrit there and told opera to look into that folder for user java scripts. but it just doesnt work
i tried search for
1 "imdb pink panther"
2."imdb_pink_pather"
3. "foo_bar"
none of the 3 worked, i get that page not found error.
my opera about info :
Version 9.00 Beta
Build 8372
Platform Win32
System Windows XP
Java Sun Java Runtime Environment version 1.5
XHTML+Voice Plug-in not loaded
User JavaScript files F:\Opera 9 Beta\userjs
jayantkaul (at) gmail (dot) com
Anonymous # 15. March 2007, 12:01
hi does this script no longer work in opera?I really want this feature its the only thing pulling me back to firefox
nicomen # 19. March 2007, 02:55