Skip navigation.

exploreopera

| Help

Sign up | Help

Opera FAQ's, Tips, Tricks & Tweaks

More about Opera browser

How to create search engine with two parameters in Opera?

, , , ,

Sometimes we need to specify two parameters for search as in the following search.

http://images.google.com/images?imgtype=face&q=monkey

It is possible to create search engine for the above using JavaScript.

By creating a search engine with the following JavaScript in address field, you can search Google Images from address bar by typing <search engine keyword><space><search parameter 1><space><search parameter 2> (example: gi face monkey)

javascript:var s='%s';var p=s.indexOf('+');if(p>-1){var s1=s.split('+');var s2=s.slice(p+1)};window.location.href='http://images.google.com/images?imgtype='+s1[0]+'&q='+s2;

To create search engine for another site, modify images.google.com/images?imgtype='+s1[0]+'&q='+s2; part in the above JavaScript. When you perform search, s1[0] will be replaced by first parameter & s2 with second parameter.

If <search parameter 1> is more than one word use the following JavaScript. Use dot instead of space as separtor between search parameters.

javascript:var s='%s';var p=s.indexOf('.');if(p>-1){var s1=s.split('.');var s2=s.slice(p+1)};window.location.href='http://images.google.com/images?imgtype='+s1[0]+'&q='+s2;

Update: Apr 28, 2008

How to undo 'Stop executing scripts on this page' option in Opera?How to sort notes in Opera?

Comments

avatar
May I say: brilliant! To be perfectly clear to new users, you need to put the javascript in the Address field of your Custom Search Engine box.

I created my own custom search straight away: Google Maps Directions.
javascript:var s='%s';var p=s.indexOf('+');if(p>-1){var s1=s.split('+');var s2=s.slice(p+1)};window.location.href='http://maps.google.nl/maps?f=d&hl=en&geocode=&saddr='+s1[0]+'&daddr='+s2;

By vd2k, # 16. February 2008, 11:38:57

avatar
:up:

By Tamil, # 16. February 2008, 18:06:16

avatar
Hi Tamil :-)

I'm trying to create a search engine for Torrentz.com using your method but I can't figure out why my solution does not work.

A usual link of this search engine is:

http://torrentz.com/search?q=foo+bar

So I create this entry:

javascript:var s='%s';var p=s.indexOf('+');if(p>-1){var s1=s.split('+');var s2=s.slice(p+1)};window.location.href='http://torrentz.com/search?q='+s1[0]'+'+s2;

Looks like it doesn't accept the "+" between the two strings and I can't understand why. Any ideas?

Thanks in advance :-)

By Gesu`, # 23. February 2008, 08:29:33

avatar

Originally posted by Gesu`:

javascript:var s='%s';var p=s.indexOf('+');if(p>-1){var s1=s.split('+');var s2=s.slice(p+1)};window.location.href='http://torrentz.com/search?q='+s1[0]'+'+s2;
You didn't place + after s1[0]
javascript:var s='%s';var p=s.indexOf('+');if(p>-1){var s1=s.split('+');var s2=s.slice(p+1)};window.location.href='http://torrentz.com/search?q='+s1[0]+'+'+s2;

Simple & easy one
http://torrentz.com/search?q=%s

By Tamil, # 23. February 2008, 08:45:52

avatar
Thank you very much, Tamil, precious has always :-)

I suppose that the site has changed its behaviour because in the past I used the "simple solution" and it didn't work. And I'm pretty sure it was that same exact string.

Anyway, thanks again!

By Gesu`, # 23. February 2008, 15:58:02

avatar
SINT DIN ROMANIA SINTETI SI DIN ROMANIA

By MAGDALENA1, # 17. April 2008, 15:58:29

avatar
Thanks for making the multi word multi parameter search string.

By MR-NF, # 15. May 2008, 16:52:40

avatar
Can you please provide code for searching one parameter in multiple engines such as Google Microsoft and Yahoo in 3 different pages using one Opera searh string? Thank you.

By Percy Shroff, # 2. July 2008, 13:21:09

avatar
I want to see search results in new tab when I use Opera's quick find. Is this possible?

By nizamx, # 4. July 2008, 16:28:37

avatar
How do you perform quick find search?

By Tamil, # 4. July 2008, 16:38:13

avatar
Customize-Buttons-Search-Quick Find
I put that search field to Opera's toolbar.

By nizamx, # 4. July 2008, 17:13:19

avatar
Try SHIFT key and enter.

By Tamil, # 4. July 2008, 17:19:56

avatar
Thanks for the help, is it also possible via adding some parameter without using shift.

By nizamx, # 4. July 2008, 17:49:21

avatar

Originally posted by nizamx:

is it also possible via adding some parameter without using shift.
AFAIK, not possible with search field.

@Percy Shroff, AFAIK it is not possible.

By Tamil, # 4. July 2008, 17:55:05

avatar
I have now found the following to work perfectly :

URL=javascript:var s='%s';window.location.href='Page with %s Susbstitued by '+s+';open('Page with %s Susbstitued by '+s+'');open('Page with %s Susbstitued by '+s+'');

By Percy Shroff, # 20. July 2008, 10:53:03

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

Please type this security code : 5d57a0

Smilies

July 2008
SMTWTFS
June 2008August 2008
12345
6789101112
13141516171819
20212223242526
2728293031