Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:

  • Design document
  • Longer document
  • Web Incubator CG issue
  • Chrome Issue
like image 662
niutech Avatar asked Sep 21 '16 08:09

niutech


2 Answers

According to Google Developers article, you can:

  • Use asynchronous script loading, using <script src="..." async> or element.appendChild(),
  • Submit the script provider to Google for whitelisting.
like image 121
niutech Avatar answered Oct 18 '22 10:10

niutech


@niutech I was having the similar issue which is caused by Rocket Loader Module by Cloudflare. Just disable it for the website and it will sort out all your related issues.

like image 26
Vaibhav Mistry Avatar answered Oct 18 '22 11:10

Vaibhav Mistry