views:

16

answers:

0

Chrome and Safari doesn't trigger the HTML5 onpopstate event. Here is my example:

<!doctype html> 
<html> 
    <head> 
        <title></title> 
        <script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; 
        <script> 
            window.onpopstate = function(e) {
                document.getElementById("log").innerHTML = "HELLO";
            }
            $(function() {
                $("a").click(function(e) {
                    e.preventDefault();
                    window.history.pushState({page: $(this).index()}, $(this).html(), $(this).attr('href'));
                });
            });
        </script> 
    </head> 
    <body> 
        <a href="new-state">Foo</a> 
        <a href="other-state">Hallo</a> 
        <div id="log"></div> 
    </body> 
</html>