Doing this with a timeout will not work reliably. An important part of the linked answer is setting a flag that your handler knows about. See Updated Question for Code.
Also, attach a temporary handler to the event that is responsible for restoring your handler:
function updateState(state, handler) { var win = $(window); function temporaryHandler() { win.unbind('hashchange', temporaryHandler); win.bind('hashchange', handler); }; win.unbind('hashchange', handler); win.bind('hashchange', temporaryHandler); $.bbq.pushState(state); }
lawnsea
source share