Reputation: 119
I want to do something like
location.pathname = "/abc"
location.search = "name=test"
It ends up getting redirected to /abc
. I want the redirection to happen to /abc?name=test
Upvotes: 5
Views: 2718
Reputation: 1074028
Just set the location
(or location.href
):
location = "/abc?name=test";
Since it's a relative URL, the protocol and host will be unchanged.
Upvotes: 4