jquery.documentsize icon indicating copy to clipboard operation
jquery.documentsize copied to clipboard

Remove `document.write`

Open proimage opened this issue 5 years ago • 1 comments

I'm getting a warning in web.dev & Chrome, caused by this library using document.write:

https://developers.google.com/web/updates/2016/08/removing-document-write

proimage avatar Jan 06 '20 18:01 proimage

Same, I wonder if it's needed. Looking through the code now.

regiside avatar Oct 27 '22 23:10 regiside

Sorry for having you kept waiting for so long. It seems that the alert is misplaced. It is supposed to warn you that document.write is used for injecting a script, which would prevent the page from being rendered until the script arrives.

According to the docs, the warning should be limited to an injection in the top-level document. In an iframe, script injections don't matter because they don't affect the rendering of the main document.

This is what actually happens: The offending line injects some HTML locally as part of a test, doesn't download a thing, and to top it all off, the HTML is even created inside an iframe.

So there are several independent reasons why the warning shouldn't be triggered. The problem it is supposed to address doesn't exist. I guess we are dealing with a Chrom bug here. And it is safe to ignore the message.

hashchange avatar Nov 04 '22 17:11 hashchange