I have two backbone model change events that occur at the same time:
change:pathreplaces current history state and patches some links
on the page,change:languageshould redirect to the new path with additional hash
Redirection should supersede replacing state, but this doesn’t happen if hash is provided. I’m trying to make it work in Chrome.
This code doesn’t redirect:
// in change:path event
window.history.replaceState({state: 1}, "", "/new_path");
// in change:language event
window.location.replace("/new_path#hash");
But without hash it works as expected:
// in change:path event
window.history.replaceState({state: 1}, "", "/new_path");
// in change:language event
window.location.replace("/new_path");
Is there any way to make it work with hash? I know I can add some timestamp to make new url totally different, but I want url to be clean.
I’ve managed to solve it in a not-so-clean way but I’m still looking for the better solution: