How do I call a javascript function every time the URL has a change with the string after the hash?
for example .com/onepage/
(onwindowload called)
.com/#1000
(need a function to be called)
.com/#500
(need a function to be called)
How do I call a javascript function every time the URL has a change with the string after the hash?
for example .com/onepage/
(onwindowload called)
.com/#1000
(need a function to be called)
.com/#500
(need a function to be called)
Here is a way......
window.location.watch(
'hash',
function(id,oldVal,newVal){
console.log(oldval+" to "+newVal);
//Do something.........
}
);