I'm using the jQuery BBQ plugin to push states to the location.hash.
To prevent a feedback loop, I'd like to disable the hashchange listener temporarily while setting the state programmatically.
I've seen this solution: Change hash without triggering a hashchange event
Unfortunately, it doesn't seem to be perfectly robust as it sometimes triggers even though I do this:
updateURL(obj){
$(window).unbind( 'hashchange');
$.bbq.pushState(obj);
setTimeout( function() { bindHashChange()}, 500);
}
Is there now a better approach to push states programmatically? Perhaps another JS library?