scharez
scharez

Reputation: 36

location.href is adding a / before pathparam?

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

Answers (1)

Mohamad Chamanmotlagh
Mohamad Chamanmotlagh

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

Related Questions