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, you have to 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. You have to 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

Write a comment

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

Please type this security code : bd9596

Smilies

May 2008
SMTWTFS
April 2008June 2008
123
45678910
11121314151617
18192021222324
25262728293031