GitHub Pages URL parameters and input

I have textbox input (for URLs) in index.html and I want to make so that you could set the value of input in URL like this: user.github.io/url?q= (or something like that). Is it possible?

1 Like

you mean a textbox with a default text ?

check this out

https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_text_defaultvalue2

No, I don’t mean default value. I learned that I need <form> in my code. I did so, but it doesn’t work. I wrote https://thenpcfish.github.io/index.html?ourl=https://google.com and everything looked fine but in textbox (name is ourl) didn’t have https://google.com value.

So you want to fill the text input element with some part of the URL? You’ll probably have to work with a bit of Javascript for that.

See: Document.URL - Web APIs | MDN

Thank you! I got it working.

1 Like