Closed ghost closed 7 years ago
Using innerHTML
does not cause the script tags in it to be executed, unlike document.write
. It's not an issue in your extension because all script tags have already been executed, and you are not trying to prevent them from executing.
fyi Chrome will blocks
document.write
, 100% of the scripts written withdocument.write
won't be executed (by design). Also, a user can switch extended blocking to alldocument.write
executions, throughchrome://flags
. This is related to both extensions and web-pages (included native web-pages source and source modified by context-script).The workaround (which is actually the proper solution as well..) is the only use
document.write
to write the DOCTYPE, since it won't work otherwise (when put innerHTML)-- and assign the rest of the HTML source intodocument.documentElement.innerHTML
.If you're getting inconsistent results with your extension, on different browsers, this is why.
Saw your code uses it, and just thought it might help. Solved it for few of my extensions (for example this one which also stops early parsing to make it more efficient..)