-
-
Save revskill10/a75160d68a53dbccbc9eb4a93c7cd9ff to your computer and use it in GitHub Desktop.
Detect pushState and replaceState
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _wr = function(type) { | |
var orig = history[type]; | |
return function() { | |
var rv = orig.apply(this, arguments); | |
var e = new Event(type); | |
e.arguments = arguments; | |
window.dispatchEvent(e); | |
return rv; | |
}; | |
}; | |
history.pushState = _wr('pushState'); | |
history.replaceState = _wr('replaceState'); | |
window.addEventListener('replaceState', function(e) { | |
if ( location.href.match(/[&?]ref_=/) ) { | |
console.warn('THOSE FUCKERS GAVE ME A ?_ref AGAIN!'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment