Skip navigation.

Opera FAQs, Tips, Tricks & Tweaks

Cool tips for 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

நல்வரவு! (Welcome!)Updated posts

Comments

vd2k 16. February 2008, 11:38

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;

Tamil 16. February 2008, 18:06

:up:

Massimo 23. February 2008, 08:29

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 :-)

Tamil 23. February 2008, 08:45

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

Massimo 23. February 2008, 15:58

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!

ALBERT DOINA 17. April 2008, 15:58

SINT DIN ROMANIA SINTETI SI DIN ROMANIA

Nate F 15. May 2008, 16:52

Thanks for making the multi word multi parameter search string.

Apna Dost 2. July 2008, 13:21

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.

nizamx 4. July 2008, 16:28

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

Tamil 4. July 2008, 16:38

How do you perform quick find search?

nizamx 4. July 2008, 17:13

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

Tamil 4. July 2008, 17:19

Try SHIFT key and enter.

nizamx 4. July 2008, 17:49

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

Tamil 4. July 2008, 17:55

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.

Apna Dost 20. July 2008, 10:53

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+'');

Anonymous 10. October 2008, 00:09

Victor writes:

Hello Tamil. Are there any way to assign favicons to these search boxes with javascript address? Thank you!

Tamil 10. October 2008, 11:29

Visit that site and then you should have favicon for JavaScript address.

Anonymous 14. May 2009, 14:20

Mwilliams writes:

Help me icant download with my opera 4.2 in 2 my n72 mobile phone

Tamil 22. May 2009, 08:42

Please ask in Opera Mini forums.

Anonymous 24. October 2009, 18:43

Redsandro writes:

Is it possible to do something like this for sites that require POST submits?

Tamil 24. October 2009, 21:11

AFAIK, not possible.

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

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

If you can't read the words, press the small reload icon.


Smilies

Download Opera, the fastest and most secure browser