browserstate / history.js

History.js gracefully supports the HTML5 History/State APIs (pushState, replaceState, onPopState) in all browsers. Including continued support for data, titles, replaceState. Supports jQuery, MooTools and Prototype. For HTML5 browsers this means that you can modify the URL directly, without needing to use hashes anymore. For HTML4 browsers it will revert back to using the old onhashchange functionality.
http://browserstate.github.com/history.js/demo/
Other
10.74k stars 1.35k forks source link

anchorchange event is triggered twice. #332

Open Pawka opened 11 years ago

Pawka commented 11 years ago

Binded anchorchange event is triggered twice on FF 23., Chrome 29.. Opera behaves fair, haven't checked on other browsers.

Try following code:

<!DOCTYPE HTML>
<html>
<head>FAIL</head>
<body>
    <script src="vendor/jquery.js"></script>
    <script src="scripts/bundled/html4+html5/jquery.history.js"></script>
    <script>
        History.Adapter.bind(window, 'anchorchange', function() {
            console.log('anchorchange');
        });

        window.location.hash = '123';
    </script>
</body>
</html>

on JS console you'll see anchorchange twice. Any ideas how to solve this quickly?

kusmierz commented 10 years ago

+1