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 });
以上是監控代碼;
刪除圖片的代碼沒有包含在內,本身控制javascript