Add parameters to URL without changing the path to the file

Asked

Viewed 329 times

1

So I have a url let’s imagine ...

http://localhost//web/index.html

The idea is to add a parameter or a variable to a url:

http://localhost//web/index.html? like=like

This parameter is written by the user when setting the url. The idea is then to use the parameter to define what will be displayed on the page.

What I don’t understand is: how come by putting this address...

http://localhost//web/index.html? like=like

I will look like the content that is already in:

http://localhost//web/index.html

where the url are different...

I don’t want to redirect to another page I just want to use that parameter in a script later.

  • 2

    ?like=like is a parameter of type GET and Urls with and without parameter point yes to the same page, this parameter is more useful if you use a server-side language

  • it is possible to access the string containing ?like=like with the javascript command: window.location.search

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.