How can using chrome extension get the source code of the frame as it is without having to modify the scripts afterwards? I tried this:
chrome.webNavigation.onDOMContentLoaded.addListener(d => { chrome.tabs.executeScript(d.tabId, { code: ` if(window.top != window.self) chrome.runtime.sendMessage(chrome.runtime.id, { message: 'html', data: document.documentElement.outerHTML } ); `, frameId: d.frameId }); }); Does not work (all the same, scripts have time to modify). With Ajax, you can't do it, because there may be different content on the same url (dynamic frame).