I want to execute code before the hashchange event affects the page. how can i execute before hash change event? I want to use a confirm box on before hash chnage so that if i press cancel button of confirm box it does not navigate to new hash. I do not want to change hash on cancel button because it opens the page as new again and my changes to page state are lost. Please provide me a quick solution.
Asked
Active
Viewed 2,337 times
3
-
2please add some relevant code for which you have posted this question. – Bhushan Kawadkar Sep 04 '14 at 07:49
-
Related: http://stackoverflow.com/questions/19673218/how-do-i-execute-code-before-a-hashchange – Derek 朕會功夫 Sep 04 '14 at 07:51
-
`$(window).on('hashchange',function(){ if(confirm("confirmation msg")){//call function} else{//do something else} });` – vikrant singh Sep 04 '14 at 09:27