Search code examples
google-chrome-extension

How do I add a general Google Search bar into an HTML page in a Google Chrome Extension?


I have made a New Tab Google Chrome extension and I am currently writing the HTML code. However, I need to add a Google Search bar to the code. How do I do that not using Google Custom Search, but just the general searching?


Solution

  • EDIT: The following example doesn't work. Check the codepen here

    You can create your own form or input tag and have it some javascript redirect the user to the Google page with the search query

    <form id=search action="https://www.google.com/search" method="get">
      <input type="search" name="q" />
      <input type="submit"/>
    </form>

    The html code above will show the google webpage with the search results.