Для получения полного доступа
зарегистрируйтесь.
RSS

All snippets tagged with "webkit" tag



samdark
  • Reputation: 348
  • Snippets: 57
  • Revisions: 5

Safari and old Chrome are triggering additional popstate event on page load. Modern Chrome fixed it but it still happens in current Safari.

The idea is to register a handler after initial popstate pops. It is triggered on load so we're adding handler for it. setTimeout with 0 delay is to make sure handler registered last.

$(window).load(function() {
    setTimeout(function() {
        $(window).on('popstate', function (e) {
                // handle it
        });
    }, 0);
});