Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to search multiple websites at once by using a keyword trigger in Google Chrome. I am trying to achieve this with Javascript as described in this topic over at mozillazine.

This is the code that supposedly works in Firefox:

javascript:void(window.open('http://www.google.com/search?q=%s'));void(window.open('http://www.altavista.com/web/results?q=%s'))

I have tried to insert this code into the "URL with %s in place of query" (right click address bar -> Edit search engines) but nothing happens when I invoke it. Is it possible to get this to work this way or another in Chrome? I would prefer to achieve this without extensions. I would appreciate a comment if it is impossible. Thank you!

share|improve this question
add comment

4 Answers

This isn't exactly what you were looking for, but it is quite helpful. Search Center which is an addon to Chrome, lets you search many sites an you can add your own too.

share|improve this answer
add comment

I have tried to insert this code [...] but nothing happens when I invoke it.

When you use a search engine from the omnibox, it just transforms the query string into an URL. That works well with actual URLs, but it can fail with javascript:.

You will be able to use this custom search if you're in a tab displaying a normal website, but not if you're looking at the New Tab or Settings page, for example. The reason is that Chrome disables javascript: URLs in any form (direct invocation from omnibox, custom search, bookmark, etc.) for the internal chrome:// pages (source).

This is done for security reasons, since these pages often contain sensitive information (e.g., New Tab contains links to the most visited websites), and JavaScript could access and divulge that information.

Is it possible to get this to work this way or another in Chrome? I would prefer to achieve this without extensions.

I don't think that there's a straightforward way of achieving this, as any attempt to automatically open several tabs from a common HTML page will result in several new windows (unless this is desired).

The best way to solve this would probably be an extension.

Further options:

  • Keep using your existing approach.

    Just make sure you don't open a new tab before you search. Since your custom search doesn't modify the existing tab, you might get used to that.

  • "Extend" your search with a bookmark.

    Leave Google (for example) as your default search and create the following bookmark:

    Name: Extend Google search
    URL:  javascript:var q=document.location.search.match(/[?&][pq]=(.*?)(&|$)/)[1];window.open('http://www.altavista.com/web/results?q='+q);window.open('http://www.bing.com/search?q='+q);void(0)
    

    Clicking the bookmark after performing a Google search will search in all other engines.

share|improve this answer
add comment

I think I found the solution to your issue here. Pretty simple extension that you could change to any search engine.

Also, if you download the source and change the popup.html file to include the code checked='checked' next to each of the terms you would like to default, so you wouldn't have to check the four boxes yourself.

Example:
change
<input type='checkbox' name='search' value="1" id='google' />Google<br />
to
<input type='checkbox' checked='checked' name='search' value="1" id='google' />Google<br />

share|improve this answer
add comment

See QuickSearch Is A Multi-Search Engine Extension For Google Chrome, which describes the extension named QuickSearch, which brings the ability to quickly perform searches via different sites.

This article also comments :

Though Chrome supports keyword based multi-search engine capabilities (Options > Basics > Default search > Manage) which enable users to search on different sites right from the omnibar, still, I would prefer this simple extension.

image

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.