Is it possible to force the browser to reload the same page with a hash?

javascript

Solution

window.location.hash = '#myFancyHash';
window.location.reload()

This is cause a reload with the new hash

Problem

I know I can add a hash to the end of the url like so: ``` window.location.hash = '#myFancyHash'; ``` But for various reasons I need to fully reload the page. On some browsers this works fine: ``` window.location = window.location.href + '#myFancyHash'; ``` But others refuse to reload the page since it sees the new url as just a hash version. Is there any way to force all browsers to redirect (reload) the page anew?

Original source

Related problems