To fix this, I'm trying to change the hash whenever the content updates and then read the hash when the page loads and update the content appropriately so users can refresh the page or bookmark certain content without problem.
The problem comes when I try to update the hash. I have a simple algorithm that generates an appropriate hash given the current content on the page. When I do
it works fine unless the URL is set to
window.location.hash = myHash;
with nothing after the hash mark. in that case when the hash is updated, i get
which of course effectively crashes the page.
If it makes a difference, I'm still developing locally so myurl is an address on my machine.