The following is not working (I just get a reload):
location.host += "/#settings";
location.reload();
How do I tell JS to navigate to a URL based on the existing url and totally reload that page (not just append the hash)?
This also does not work:
window.location.href = "/#settings";
My base url is "http://localhost:sss/pricing"
I want to redirect to "http://localhost:sss/#settings"
with a reload.
I don't want to type localhost
anywhere.
Even this gives me settings#lol
:
var desiredBase = window.location.protocol + "//" + window.location.host + "/";
var path = '#lol';
window.location.href = desiredBase + path;
location.reload();