Skip to content

Instantly share code, notes, and snippets.

@ashramwen
Forked from rudiedirkx/detect-history-state.js
Last active January 28, 2021 03:10
Show Gist options
  • Save ashramwen/ce91a709428cba947890484556ce7b0f to your computer and use it in GitHub Desktop.
Save ashramwen/ce91a709428cba947890484556ce7b0f to your computer and use it in GitHub Desktop.

Revisions

  1. ashramwen revised this gist Jan 28, 2021. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions detect-history-state.js
    Original file line number Diff line number Diff line change
    @@ -10,8 +10,6 @@ var _wr = function(type) {
    };
    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!');
  2. @rudiedirkx rudiedirkx created this gist Sep 4, 2014.
    19 changes: 19 additions & 0 deletions detect-history-state.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    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!');
    }
    });