Disable popstate listener temporarily

mgibbs189

{{gist file=”custom.js” lang=”javascript”}}
<script>
(function($) {
FWP.hooks.addAction(‘facetwp/ready’, function() {

// remove the popstate listener
$(window).off(‘popstate’);

// add it back after 10 seconds
window.setTimeout(function() {
$(window).on(‘popstate’, function() {

// Detect browser “back-foward” cache
if (FWP.is_bfcache) {
FWP.loaded = false;
}

if ((FWP.loaded || FWP.is_bfcache) && ! FWP.is_refresh) {
FWP.is_popstate = true;
FWP.refresh();
FWP.is_popstate = false;
}
});
}, 10000 );
});
})(jQuery);
</script>
{{/gist}}