r/ProgrammerHumor • • Oct 08 '26

Meme atThisPointImTooAfraidTooAsk

Post image
4.4k Upvotes

86 comments sorted by

View all comments

Show parent comment

13

u/Strict_Treat2884 Oct 08 '26 edited Oct 08 '26

I guess it's because JavaScript is synchronous (without defer or async ofc), it must be parsed and executed on the spot when constructing the webpage (mainly thanks to document.write?).

While <link> does't affect the document content itself, so it's meant to handle resourses that can be handled later. That's why JavaScript cannot be loaded by <link>, I reckon.

4

u/conundorum Oct 08 '26

Perhaps this could be solved by allowing <link urgent="true" script="whatever.js.your.boat">? Allow a tag to command the page to load and parse the script on the spot.

(Well, that or account for multipass parsing to load resources on one pass and execute them on the next, but that sounds like a nightmare for dynamically updated sites.)