Use Google to search by URL

I want to use Google to search in my url. I want to use this code:

site: http://my-url.ir/ my_words_that_want_to_search 

then I have text input and a search button

I want HTML (or JavaScript) when I click on the button to put the text that is in the text input

 site: http://my-url.ir/ text_that_is_in_text_input 
+4
source share
1 answer

Check out the Google Custom Search Engine , which will create these code snippets for you.

According to this anatomy of the query string , you can simply add another parameter instead of adding site:xyz to the search string:

 <form method="GET" action="//www.google.de/search"> <input type="hidden" name="as_sitesearch" value="http://example.com"> <input type="text" name="q"> <input type="submit" value="Search!"> </form> 

No need to use JavaScript for a simple search form.

+3
source

Source: https://habr.com/ru/post/1433410/


All Articles