9

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!

5 Answers 5

4

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.

2
  • perfect, exactly what i was looking for. No more copy pasting of search terms across search sites.
    – tinker
    Oct 4, 2019 at 7:42
  • This website (searchonce.net) also useful too.. Jul 20, 2022 at 13:19
3
+50

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.

1

Big Search is an addon with the feature you need. It's cross-browser, for both Chrome and Firefox.

Screenshots
Extension UI Context selection search Use on web without install Mobile UI (web)
screenshot_en screenshot_context screenshot_web screenshot_mobile

Watch demo video

Comparing to other similar tools, this tool uses JSON for search engines database (both built-in and user-defined), so it has strong flexibility in engine data.

0

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

0

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.

For 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 />

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .