 <p>I would prefer to do like this:</p> <pre><code>if (window.onpopstate != undefined) { window.onpopstate = locate; } else { window.onhashchange = locate; } </code></pre> <p>so if "msie" add this functionality you do not depend on old code</p>