本文介绍了PageSpeed指责“渲染阻塞”脚本当使用外部图像时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面正文的结束标记之前放置了CDN中的脚本(位于 t延迟渲染?


正确,他们没有。

我会报告错误。我没有看到任何关于该脚本的渲染阻塞。我甚至尝试在固定大小的中包装 img code>,仍然有错误。看不到为什么该脚本会呈现阻塞状态;如果你将它报告为一个错误,结果是有原因的,那么这是一个好结果。但更可能是一个错误。


I have placed a script from a CDN just before the closing tag of my page's body (above </body>). Google's PageSpeed Insights says:

I thought scripts before the end of my </body> don't delay the rendering?

After some trial and error I found out that this is caused because my page uses an external image. With the example below you can cause PageSpeed to detect a "render-blocking" script:

<body>
    <img src="http://i.stack.imgur.com/oURrw.png" />
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
</body>

Does this really cause a delay in rendering my page?

解决方案

Correct, they don't.

I'd report that as a bug. I don't see anything render-blocking about that script. I even tried wrapping the img in a fixed-size, overflow: none div, and still got the error. Can't see why that script would be render-blocking; if you report it as a bug, and it turns out there's a reason, well, that's a good result. But more likely it's a bug.

这篇关于PageSpeed指责“渲染阻塞”脚本当使用外部图像时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 20:55