Lighthouse: False positive blocking scripts

Created on 14 Jun 2017  Â·  7Comments  Â·  Source: GoogleChrome/lighthouse

Scripts loaded after the main load event are considered as blocking if they are prefetched in the head.

It is exemplified in this gist, where in the document's head a

<link as="script" src="/main.js" rel="preload">

tag is present and at the end of the body the preloaded script is added by

document.createElement('script')
script.src = '/main.js'
document.head.appendChild(script)

(Opened after https://github.com/google/WebFundamentals/issues/4694)

P1.5 bug good first issue needs-investigation

All 7 comments

Hm we didn't do the same handling for scripts that we did for links since defer and async make it a much less common use case. What's the primary benefit of this method over marking as async?

What's the primary benefit of this method over marking as async?

It's that I can chain multiple script loads, having control over the request order.

I see, and the script elements need to be appended to the head, not the body?

That's not important, in facts the fastest solution was to change that.
I'm opening this issue just to notify it 😉

gotcha thanks for the report! :)

We think isLinkPreload from here https://chromedevtools.github.io/devtools-protocol/tot/Network/#type-Request will sort this out... But also it's implemented like this already. TBD!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

muuvmuuv picture muuvmuuv  Â·  3Comments

devrsi0n picture devrsi0n  Â·  3Comments

mohanrohith picture mohanrohith  Â·  3Comments

sanprieto picture sanprieto  Â·  3Comments

mjara74 picture mjara74  Â·  3Comments