user14059067
user14059067

Reputation:

Force reload of page with URL containing an anchor (#)

I want to reload a page like so :

window.location.href = url;

But given my url contains an anchor the previous instruction won't do anything. How to deal with this issue ? Thank you for the great help.

Upvotes: 0

Views: 108

Answers (2)

user14401450
user14401450

Reputation:

You can do location.replace("https:/rickrolled.com"); So, to redirect, you can do location.replace(location.href);

Or just do location.reload();

If it doesn't work, please send me a JSFiddle of your project.

Upvotes: 1

D. Pardal
D. Pardal

Reputation: 6587

Just use:

window.location.reload();

Upvotes: 1

Related Questions