Is that correct? I was thinking it was just an event that fired when the page refreshed. I did a basic document.write
and did i++
whenever onhashchange was triggered but it always is at 0 and i lose all my other vars and stuff. I also tried re开发者_Go百科turn false, but nothing.
Am i doing it wrong? Or is onhashchange supposed to reset the page? If so, can you stop it but still fire the callback?
No onHashChange
merely fires whenever the # portion of a url is changed, this is client-side only and the page should not reload when doing so. document.write
however can clobber your global variables.
If you need more help we'll need more to go on.
It looks like the problem is that Web Inspector is super buggy with this. For example, multiple console.log()s in a onhashchange
rewrite the same console.log(). Also, i noticed that sometimes the console would just go completely blank when changing pages. I discovered it's bugginess when I put a timer on the page and noticed the timer was incrementing but the console was showing blank or misinformation.
精彩评论