back button history handling for iframe with jquery (IE failed me again)
<script src=js/jquery/1.3.2.js></script>
<script src=js/jquery/timers.js></script>
<a name=n1 url=http://g.cn />
<a name=n2 url=http://sohu.com />
<a name=n3 url=http://pcpop.com />
<a href=#n1>g.cn</a>
<a href=#n2>sohu.com</a>
<a href=#n3>pcpop.com</a>
<hr/>
<iframe name=iframe width=1280 height=1024></iframe>
<script>
var cm = {hash: ''}
$(document).everyTime(100, function(){
var hash = location.hash
if(hash && cm.hash != hash){
cm.hash = hash
frames.iframe.location.replace($('a[name='+hash.slice(1)+']').attr('url'))
}
})
</script>
Doesn't work in IE...>_<
Turns out there are plugins for this already...jQuery history jQuery Address jQuery BBQ