So I see a lot of people recommend the hidden-iFrame
hack that is jQuery history plugin but all I really need is the other half of this technique:
function whenItemIsClicked()
{
window.location.hash = this.id;
//some other stuff, like Ajax
}
//and then, if page is reloaded...
$(document).ready(function(){
var loc = window.location.hash;
//if there happens to be a hash, navigate to corresponding content
if(loc != '') $(loc).click();
});
Both of these work great. Now, I'd like to attach these two lines
var loc = window.location.hash;
if(loc != '') $(loc).click();
to an event, but it seems there isn't one that will be triggered consistently by the back button. Is there a way to add a browser history state that will save the present URL so the above technique will work?