Reputation: 36
I am trying to use location.href to a folder where a index.php file is located!
So when I am use location.href = "databases?page=settings";
it redirects me to
/databases/?page=settings. Why is Javascript adding a / before the pathparameter?
Upvotes: 1
Views: 236
Reputation: 332
That's the way href
works, It is designed to change URL to a child page of current page, unless you specify you want to go to another domain (for example having http://
at the start of the url). If you looking to change URL otherwise, you can use location.replace(document.location + "databases?page=settings")
Upvotes: 0