hashchange事件
参考:
需要解决的问题:
1.IE6/7及兼容模式下的IE8不支持onhashchange事件,(而且hash改变不会产生history)
解决办法:用定时器来检测hash的变化;用隐藏的iframe调用document.write方法来产生历史;
2.hash的提取有兼容性问题:
* IE6会取少一总分hash,
如http://www.cnblogs.com/rubylouvre#stream/xxxxx?lang=zh_c IE6 > location.hash = #stream/xxxxx
其他浏览器 > location.hash = #stream/xxxxx?lang=zh_c
* firefox会对hash进行decodeURIComponent
比如 http://www.cnblogs.com/rubylouvre/#!/home/q={%22thedate%22:%2220121010~20121010%22}
firefox 15 => #!/home/q={"thedate":"20121010~20121010"}
其他浏览器 => #!/home/q={%22thedate%22:%2220121010~20121010%22}
3.html5 history api 兼容pushState与replaceState, 研究一下history.js