Opera FAQs, Tips, Tricks & Tweaks

Tips for Opera browser since 2005

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

vd2k Saturday, February 16, 2008 11:38:57 AM

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 Saturday, February 16, 2008 6:06:16 PM

up

MassimoPetrax Saturday, February 23, 2008 8:29:33 AM

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=%27+s1[0]%27+%27+s2;

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

Thanks in advance :-)

Tamil Saturday, February 23, 2008 8:45:52 AM

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=%27+s1[0]%27+%27+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=%27+s1[0]+%27+%27+s2;


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

MassimoPetrax Saturday, February 23, 2008 3:58:02 PM

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 DOINAMAGDALENA1 Thursday, April 17, 2008 3:58:29 PM

SINT DIN ROMANIA SINTETI SI DIN ROMANIA

Nate FMR-NF Thursday, May 15, 2008 4:52:40 PM

Thanks for making the multi word multi parameter search string.

Apna DostPercy Shroff Wednesday, July 2, 2008 1:21:09 PM

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 Friday, July 4, 2008 4:28:37 PM

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

Tamil Friday, July 4, 2008 4:38:13 PM

How do you perform quick find search?

nizamx Friday, July 4, 2008 5:13:19 PM

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

Tamil Friday, July 4, 2008 5:19:56 PM

Try SHIFT key and enter.

nizamx Friday, July 4, 2008 5:49:21 PM

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

Tamil Friday, July 4, 2008 5:55:05 PM

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 DostPercy Shroff Sunday, July 20, 2008 10:53:03 AM

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

Unregistered user Friday, October 10, 2008 12:09:53 AM

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

Tamil Friday, October 10, 2008 11:29:45 AM

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

Unregistered user Thursday, May 14, 2009 2:20:52 PM

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

Tamil Friday, May 22, 2009 8:42:59 AM

Please ask in Opera Mini forums.

Unregistered user Saturday, October 24, 2009 6:43:45 PM

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

Tamil Saturday, October 24, 2009 9:11:34 PM

AFAIK, not possible.

xiborg Tuesday, February 9, 2010 3:01:01 PM

Great scriptlet.
Thank you

Unregistered user Wednesday, March 17, 2010 2:43:57 PM

Richard writes: Hi Tamil I want to create a search engine for http://www3.appliedbiosystems.com/AB_Home/index.htm , they have a javascript search there and I cannot figure out where I am making a mistake. Can you suggest? Thanks R

Tamil Thursday, March 18, 2010 5:53:02 AM

Go to that site, right click on box with text enter search term and click create search...

Unregistered user Thursday, March 18, 2010 9:20:32 AM

Richard writes: Great, thank you. Pretty easy :-(

NoOoSi Monday, May 3, 2010 1:57:02 PM

Is it possible to create a search engine for sites like http://ddlgetter.net/ ??

The url doesn't change here after performing a search and i couldnt find any hint within the source code either...

When creating a search engine "javascript:sendRequest();" is shown in the adress field - but this alone doesnt work of course...

Tamil Monday, May 3, 2010 3:03:11 PM

Create search engine with following address.
http://ddlgetter.net/main.php?side=search&action=search&tag=%s&listart=off&cat=1


NoOoSi Tuesday, May 4, 2010 8:06:49 AM

thank you =) how did you figure that out?

what if i want to do a search for a single host ("share-online.biz" for example), what string do i have to add to the address?

Tamil Thursday, May 6, 2010 2:55:46 PM

Originally posted by NoOoSi:

how did you figure that out?

Using Proxomitron log window.

Originally posted by NoOoSi:

what if i want to do a search for a single host ("share-online.biz" for example), what string do i have to add to the address?

I can't figure it out.

efAston Saturday, October 16, 2010 11:42:00 AM

Apna Dost # 20. July 2008, 20: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+'');



When I tried that it opened the search results in the new tab, but in the active tab as well. Is there any way of doing it without affecting the active tab?

Tamil Sunday, October 17, 2010 2:06:55 PM

sherlock

efAston Sunday, October 24, 2010 2:00:37 AM

Actually, Settings→Preferences→Advance→Tabs and deselecting "Reuse current tab" was a better solution.

Tamil Sunday, October 24, 2010 2:10:30 AM

m3admwebm3web Thursday, December 16, 2010 10:16:46 PM

i wanter to creat a search engine for youtube, but i have no idea!

Tamil Thursday, December 16, 2010 11:27:34 PM

Go to YouTube > Right click in search box > Create Search...

m3admwebm3web Monday, December 27, 2010 8:53:20 PM

i cannot find this option on opera 11. can you?

Tamil Tuesday, December 28, 2010 12:21:29 AM

Do you use custom menu setup?

Unregistered user Tuesday, December 28, 2010 8:12:32 AM

Leo writes: Hi Tamil, Right click & Create Search does not work for Google Maps (at least for me). Is there any address that works?

Tamil Tuesday, December 28, 2010 8:26:11 AM

Try the following address.
http://maps.google.com/maps?q=%s

Unregistered user Tuesday, December 28, 2010 10:10:35 AM

Leo writes: Thanks!

lifeh2o Monday, January 3, 2011 8:20:23 AM

I found that, just like %s, %i adds an integer 0 to search. Are there any other variables like that?

lifeh2o Monday, January 3, 2011 8:27:03 AM

When i add %i many times it adds 0 805886432 0 1235992 2089872920 7536737 respectively

lifeh2o Monday, January 3, 2011 8:28:17 AM

Is there anyway i can add google site search in it?

Tamil Monday, January 3, 2011 2:47:00 PM

Originally posted by lifeh2o:

Are there any other variables like that?

%t = currently selected text
%c = clipboard content
%u = active document URL
%l = link address

%i = number of results and it is no longer supported

Unregistered user Friday, April 15, 2011 4:23:07 PM

Uttam writes: Hi Tamil, would you please create a search engine for this site: http://www.indianrail.gov.in/pnr_stat.html? I tried many things but with no success at all. It takes two inputs I think. Thank you.

Tamil Saturday, April 16, 2011 9:58:23 AM

Not possible because Indian Railways uses POST method. sad

Unregistered user Saturday, April 16, 2011 4:22:52 PM

Uttam writes: Hi Tamil, I think opera also supports POST method. There is a check box saying 'use POST'. Anyways, I'm not a geek. I made the search engine indirectly and its working fine. Thanks for the script. 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://www.irctc-pnrstatus.com/IndianRail.aspx?pnrNo1='+s1[0]+'&pnrNo2='+s2;

Tamil Saturday, April 16, 2011 4:25:32 PM

I think opera also supports POST method.

yes

I tried with indianrail.gov.in but didn't work.

phpmoli Thursday, June 30, 2011 9:48:45 PM

more valid javascript code:

URL="javascript:const delimiter='%3B';var s='%s';var s1=(s.indexOf(delimiter)>-1?s.substring(0,s.indexOf(delimiter)):s);var s2=(s==s1?'':s.substr(s.indexOf(delimiter)+delimiter.length));location.href='http://maps.google.hu/maps?f=d&dirflg=r&saddr='+s1+'&daddr='+s2;"

Tamil Friday, July 1, 2011 2:25:20 AM

up

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