lundi 30 novembre 2020

How to implement Google Search bar in HTML website?

Long time lurker here. Is that any possible way to implement Google Search bar in basic HTML website? I have tried it and succeeded, but I have this one issue - it keeps redirecting me to Google Search itself. I need to print the output and display it right on the website. In the form that the user inputs something and instead of redirecting to Google, it prints the first page of search results right on the website, for example underneath "Results" title.

Also, second question - how to allow the user to download the page? For example, it prints the results and underneath is "Download" button that lets him save the page in whatever format he chooses.

Thanks a ton!

EDIT: So far I have come up with this code:

<html>
<p><strong>Vyhled&aacute;v&aacute;n&iacute; na Googlu</strong></p>
<body>
<form method="get" action="http://www.google.com/search">
<div style="border:1px solid black;padding:4px;width:20em;">
  <table border="0" align="center" cellpadding="0">
  <tr><td>
  <input type="text"   name="q" size="25"
  maxlength="255" value="" />
  <input type="submit" value="Google Search" /></td></tr>
  <tr><td align="center" style="font-size:75%">
  <input type="radio"  name="sitesearch" value="" />Web
  <input type="radio"  name="sitesearch"
  value="yoursite.com" checked /> Pouze tato stránka<br />
  </td></tr></table>
  </div>
</form>
<p><br><br><b>Výsledky:</b></p>
<form method="get" action="test.html">
   <button type="submit">Stáhnout stránku</button>
</form>
<a href="test.html" download>Stáhnout</a>
</body>
</html>



Aucun commentaire:

Enregistrer un commentaire