forxtu
5/14/2018 - 11:28 AM

Check if url changes

// check if url changes
  var oldURL = "";
  var currentURL = window.location.href;
  function checkURLchange(currentURL){
    if(currentURL != oldURL){
        console.log('url changed');

        oldURL = currentURL;
    }

    oldURL = window.location.href;
    setInterval(function() {
        checkURLchange(window.location.href);
    }, 1000);
  }

  checkURLchange();