Home > Enterprise >  Open google search function with JavaScript
Open google search function with JavaScript

Time:04-20

Is it somehow possible to open this search with JavaScript ?

If yes, can we also pass it some default value ?

enter image description here

Context

I want to create a search function that highlight every element in my page that match the searched functionality like this

enter image description here

CodePudding user response:

Try using window.find(stringtofind)

Src: https://developer.mozilla.org/en-US/docs/Web/API/Window/find

CodePudding user response:

Could you explain more? Are you hoping to open google with a button click in a new browser tab?

As for giving it a default search value, should be pretty easy. You just have to edit the end of the URL after the equals sign: https://www.google.com/search?q=test

  • Related