var targetNode = document.body
const config = { childList: true ,characterData: true, subtree: true, attributes: true,};// callback function
const callback = function (mutationsList, observer) {
let node1 = document.getElementsByClassName("Tappable-module_root__N7ll5 absolute crt-popup_close_button__ZhQDT");
node1[0].click()
let node2=document.getElementsByClassName("exit-intent_close_icon__lxzbB")
node2[0].click()
console.log('Changes Detected');
};// Create observer instance
const observer = new MutationObserver(callback);
observer.observe(targetNode, config);
- when opening sites of this type a pop up appers periodically blocking reading content
- without we manually closing these windows each time and without periodically checking them manually
mutation observer
is used
- we observe the documents body
- we write a call back function in which we extract the needed nodes and click the necessary buttons to close them
- we make a mutation observer object-observer
- and we observe the target node with configuration
- just paste this code in console when openign the sites of scalar academy
- there wont be any periodic popups blocking the content