Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do you make a new search engine in Google Chrome if the search term has to be a POST variable?

I tried translating the POST data into a GET querystring with the %s placeholder but this didn't work.

share|improve this question

migrated from May 23 '11 at 21:07

This question came from our site for professional and enthusiast programmers.

Why don't you use google search api instead ? – ppumkin Jan 23 '12 at 22:00
up vote 8 down vote accepted

I managed to get what I want with this (pretty nasty indeed) workaround: a javascript url that creates and immediatly submits the form. This means, when you define your search engine, insted of an url like this:

you would use this url/code:

javascript:document.write('<form name="f" action="" method="POST"><input type="hidden" name="term" value="%s"></form><script>f.submit();</script>');

Since it'll most likely be a pretty long string it's better to prepare it in a text editor and then copy-paste it in the url field.

This is the search url for an Italian-English dictionary: javascript:document.write('<form name="f" action="" method="POST"><input type="hidden" name="lemma" value="%s"><input type="hidden" name="sez" value="ita"></form><script>f.submit();</script>');

P.S. Unfortunately, this method doesn't work when performing search from empty "New Tab" page. This can be fixed by installing "Ultimate New tab" extension.

share|improve this answer

I don't see any other option than creating another webpage, which would accept the search query as GET and then immediately resend it as POST.

share|improve this answer

First you need to host page with this PHP code:

<!DOCTYPE html>
    <form name="f" action=""<?php echo htmlspecialchars($_GET['action']); ?>" method="POST">
        <input type="hidden" name="<?php echo htmlspecialchars($_GET['inputname']); ?>" value=""<?php echo htmlspecialchars($_GET['inputvalue']); ?>">

Then put in search url:

(replace urls, filenames and input name to your data)

For example (search on via host
share|improve this answer

You must log in to answer this question.

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