发新话题
打印

chrome:Blocking the load of cross-origin inserted via document.write

chrome:Blocking the load of cross-origin inserted via document.write

解决办法:换浏览器

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

chrome://flags/#disallow-doc-written-script-loads

Chrome对document.write优化
由于document.write的种种拙劣表现,Chrome决定对其有一波强制的优化,全部符合以下6点的,通过document.write()加载的<script>将不会被执行。
本着用户体验至上的原则,Chrome 的工程师们准备进行一个大胆的尝试,那就是屏蔽掉这种脚本,具体的屏蔽规则是,符合下面所有这些条件的 script 标签对应的脚本不会再被 Chrome 执行:

弱网,特别是2G(以后可能会提升为slow 3G 或 slow WiFi)。
所在页面是顶层的(self === top),而不是 iframe。因为iframe中并不影响主页面的渲染。
同步加载的,也就是不带有 asyc 或 defer 属性的。因为即便写在 document.write 里,异步的 script 标签也不会阻塞后面脚本的执行以及后面 HTML 源码的解析。
跨站的(注意不是跨域)。Chrome will not intervene for scripts with a matching eTLD+1 (例如:script 域名为 js.example.org ,插入到www.example.org中,Chrome不会干涉)。(eTLD: effective top-level domain)
未被缓存的。因为已被缓存的不会引起加载速度的问题。
所在页面的此次加载不是通过刷新操作触发的。虽然说第三方脚本影响页面主体内容和功能的可能性不大,但仍然有这个可能,假如页面主体内容收到影响了,用户必然会点刷新,所以刷新的时候,这个屏蔽逻辑得关掉


https://www.jianshu.com/p/806846f532ba

https://www.jianshu.com/p/806846f532ba

http://www.cnblogs.com/ziyunfei/p/5881426.html

TOP

发新话题