adding a search button to google

Subscribe to adding a search button to google 4 posts, 3 voices

 
Ronen Mendez... User

I have a search engine i'm using, and wondered if it is possible to just add a button next to the google search button, so it'll send queries to my search engine instead to google?

Example:
http://img.photobucket.com/albums/v613/ronen82/...

the idea is to send to any search engine the query, so anyone can actually choose where to search, google or somewhere else.

The reason i want this, even though i do have the option to change search engines in the search bar in firefox, is so i don't need to start choosing where to search each time, just choose a button and click it.

let me know if someone can do this, or help out

 
dob Scriptwright

That's very well possible.
You can add as many search engine buttons as you want, all you need to tell us is the action attribute of your search forms.

 
Ronen Mendez... User

well, i want to be able to add them myself, just need a template, but i can give an example for one i suppose:
the search string is:
http://www.mysearchsite.com/search?search=query

 
Informatic User

i made this :)
here code:

// ==UserScript==
// @name           OtherSearchEngine
// @namespace      [...]
// @description    Adds button "Search in [your search engine]" to main Google page.
// @include        http://www.google.*/
// @include        http://google.*/
// ==/UserScript==
var searchengine = "MySearchSite";
var searchstring = "http://www.mysearchsite.com/search?search=";

var luckyButton = document.getElementsByName("btnI")[0];
var newbutton = document.createElement("input");
newbutton.setAttribute("type","button");
newbutton.setAttribute("value","Search in "+searchengine);
newbutton.setAttribute("onclick","document.location = \""+searchstring+"\"+escape(document.getElementsByName(\"q\")[0].value);");
luckyButton.parentNode.appendChild(newbutton);
//alert(luckyButton.parentNode.innerHTML);

in variable searchengine you set your search engine name, and in searchstring you set search string.

see ya.
Informatic