Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

window change detect

// listen for window reload or part of the page reload
var oldHref = document.location.href;

window.onload = function() {
    var bodyList = document.querySelector("body")
        ,observer = new MutationObserver(function(mutations) {
            mutations.forEach(function(mutation) {
                if (oldHref != document.location.href) {
                    oldHref = document.location.href;
                    /* Changed ! your code here */
                }
            });
        });

    var config = {
        childList: true,
        subtree: true
    };
    observer.observe(bodyList, config);
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: connect ECONNREFUSED 127.0.0.1:80 nuxt config 
Javascript :: refresh modal on button click jquery 
Javascript :: how to delay something in javascript 
Javascript :: document.queryselectorall extract all href element 
Javascript :: nodejs read image as base64 
Javascript :: join array 
Javascript :: bootstrap not working in print 
Javascript :: how to pass data in body of delete request angular 
Javascript :: convert jquery to string 
Javascript :: react native meter 
Javascript :: Error occurred while trying to proxy to: localhost:3000/ 
Javascript :: find max and min value in array javascript 
Javascript :: try catch in react native 
Javascript :: import syntax node 
Javascript :: jquery each hover 
Javascript :: check if object is not defined js 
Javascript :: how to dynamic title in nuxt 
Javascript :: javascript capitalize all letters 
Javascript :: javascript add an element to an array 
Javascript :: addeventlistener javascript 
Javascript :: get methods on an js object 
Javascript :: video mute and unmute 
Javascript :: json db 
Javascript :: js find integer 
Javascript :: loops in javascript 
Javascript :: calling angular component method in service 
Javascript :: read image metadata javascript 
Javascript :: javascript replace spaces with br 
Javascript :: keyup in jquery 
Javascript :: localecompare javascript 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =