A Parser-blocking, cross-origin script is invoked via document.write - how to circumvent it?

niutech picture niutech · Sep 21, 2016 · Viewed 118.7k times · Source

Google Chrome started implementing Blocking the load of cross-origin, parser-blocking scripts inserted via document.write in the main frame on slow networks, which causes the following error:

A Parser-blocking, cross-origin script, http://example.org/script.js, is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity.

However, my web page requires loading a third party script synchronously, using document.write('<script src="..."></script>'). How to circumvent that blockade?

More about that change:

Answer

niutech picture niutech · Sep 21, 2016

According to Google Developers article, you can: