async-document-write icon indicating copy to clipboard operation
async-document-write copied to clipboard

Automatically inject document.write tracker code into all async scripts

Open eligrey opened this issue 6 years ago • 0 comments

This will make eval(document.write.START) and eval(document.write.END) unnecessary.

If the context is an async script element without an src containing text, add in text and run script.parentNode.replaceChild(document.importNode(script, true), script). I will need to disable document.write() entirely before executing the modified tracker code so that initial runs are ignored.

If the context is an async script element with an src, async XHR/Fetch the src, add tracker code, change src to blob URI for the new content, and run script.parentNode.replaceChild(document.importNode(script, true), script).

eligrey avatar Jan 10 '18 11:01 eligrey