Problems with Javascript in Safari
document.location.hash = “#anchorName” does not do what you might expect. Looking at the addressbar, I see “http://mydomain.com/mypage.html#%23anchorName” instead. Apparently, you need to omit the hash mark for Safari. Luckily it seems to work on other browsers too. The O’Reilly book Javascript: The Definitive Guide states that location.hash includes the “#”, but I guess we’ll just go with what works.
Using jquery’s html() method for replacing the inner HTML of an element doesn’t work. I think it’s just using javascript’s innerHTML attribute, which is supposed to work, from what I found Googling around. But it wasn’t working for me. Oh well, I found a way to work in this case without innerHTML.