Get the hash value which was before hashchange

hash, html, javascript, jquery

Solution

use that

$(window).on("hashchange", function(e){
    console.log(e.originalEvent.oldURL)
    console.log(e.originalEvent.newURL)
})​;

Demo: http://jsbin.com/ulumil/

Problem

Suppose my html is ``` <a href="#one">One</a> <a href="#two">Two</a> ``` and Js is ``` $(window).on("hashchange"){ alert(document.location.hash); } ``` I want to get the hash value which was before hash change .Is it Possible?If yes ,How?

Original source

Related problems