Detect hashchange and hash existed code run duplicate?
https://stackoverflow.com/questions/33056521/detect-hashchange-and-hash-existed-code-run-duplicate
var hash = '';
$(document).load(function() {
$(window).trigger('hashchange');
});
$(window).on('hashchange', function() {
if (hash == window.location.hash) {
// do nothing, hash is the same as it was previously
return;
}
hash = window.location.hash;
if (hash) {
alert("Apple");
}
});