Search code examples
javascripturlinputfieldinputbox

Add value to field by URL ?name=data


You know passing value to field by URL could be done by :

?name=data

For example :

Google.com/?q=stackoverflow

And then when you open this link you have "stackoverflow" written in the field. But I can't do this with some websites. For example : ( GitHub search bar name is also "q" )

github.com/?q=stackoverflow

If you open this link there is no text in the search field. I want to know why and how to make this method work for these websites?


Solution

  • The site has to parse the data out of the URL and use it to set the value attribute of the input when they generate the HTML to send to the browser.