代码语言:javascript复制
let body = document.querySelector("iframe").contentDocument.body;
let observer = new MutationObserver((mutationsList, observer) => {
for (let mutation of mutationsList) {
if (mutation.removedNodes.length > 0) {
console.log(mutation);
console.log(mutation.removedNodes)
}
}
});
observer.observe(body, { subtree: true, childList: true });
以上是监控代码; 删除图片的代码没有包含在内,自己控制