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

wizardnet972 picture wizardnet972  路  3Comments

codepodu picture codepodu  路  3Comments

timj2 picture timj2  路  3Comments

workjalexanderfox picture workjalexanderfox  路  3Comments

radum picture radum  路  3Comments