1//listen for window resize event
2window.addEventListener('resize', function(event){
3 var newWidth = window.innerWidth;
4 var newHeight = window.innerHeight;
5});
1// listen for window reload or part of the page reload
2var oldHref = document.location.href;
3
4window.onload = function() {
5 var bodyList = document.querySelector("body")
6 ,observer = new MutationObserver(function(mutations) {
7 mutations.forEach(function(mutation) {
8 if (oldHref != document.location.href) {
9 oldHref = document.location.href;
10 /* Changed ! your code here */
11 }
12 });
13 });
14
15 var config = {
16 childList: true,
17 subtree: true
18 };
19 observer.observe(bodyList, config);
20};