Open
Description
When JS creates a script
tag dynamically in the DOM tree, the browser should fetch and execute the corresponding JS.
Example with https://hn.algolia.com/, a inline script creates a new script
tag, ligthpanda executes the JS, but it never loads the script created.
var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/[email protected]";
!function (e, a, t, n, s, i, c) {
e.AlgoliaAnalyticsObject = s, e.aa = e.aa || function () {
(e.aa.queue = e.aa.queue || []).push(arguments)
}, i = a.createElement(t), c = a.getElementsByTagName(t)[0],
i.async = 1, i.src = ALGOLIA_INSIGHTS_SRC, c.parentNode.insertBefore(i, c)
}(window, document, "script", 0, "aa");
// Initialize library
aa('init', {
appId: 'UJ5WYC0L7X',
apiKey: '28f0e1ec37a5e792e6845e67da5f20dd'
});
If I fetch the page, I can see the tag created, but it is never loaded.
$ zig build run -- fetch --dump 'https://hn.algolia.com/'
info(browser): GET https://hn.algolia.com/ 200
info(browser): fetch https://hn.algolia.com/public/main-6e634771f729331a3c3c.js: 200
info(xhr): GET https://telemetry.algolia.com/1/settings?applications=UJ5WYC0L7X 200
<!DOCTYPE html>
<html><head>
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0,minimal-ui" name="viewport"><title>Hacker News Search powered by Algolia</title><meta content="Hacker News Search, millions articles and comments at your fingertips." name="description"><link rel="shortcut icon" type="image/png" href="public/algolia-mark-rounded-orange.png">
<link rel="stylesheet" href="/public/main-c5f3115f9134e1a76af1.css"><meta name="csrf-param" content="authenticity_token">
<meta name="csrf-token" content="IjE4ZjcyZDFhZmEwYzdmNmU5NTg3YTcxMmJiZGM5NzdmOWYyODBlMjIi.aCNlzw._V7NS_QU98R5gYdP15DGSmCEKps">
<link rel="alternate" type="application/rss+xml" title="HN Front page" href="https://hn.algolia.com/rss"><link rel="alternate" type="application/atom+xml" title="Latest HN items" href="https://hn.algolia.com/latest.atom">
<meta content="summary" name="twitter:card"><meta content="@algolia" name="twitter:site">
<meta content="HN Search powered by Algolia" name="twitter:title"><meta content="Hacker News Search, millions articles and comments at your fingertips." name="twitter:description"><meta content="algolia.com" name="twitter:domain">
<meta content="light dark" name="color-scheme">
<meta content="HN Search powered by Algolia" property="st:title">
<meta content="HN Search" property="og:site_name">
<meta content="HN Search powered by Algolia" property="og:title">
<meta content="Hacker News Search, millions articles and comments at your fingertips." property="og:description">
<meta content="600" property="og:image:width"><meta content="315" property="og:image:height">
</head><body>
<noscript>This page will only work with JavaScript enabled</noscript>
<main id="root"><div class="default light"></div>
</main>
<script async="" src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script>var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/[email protected]";
!function (e, a, t, n, s, i, c) {
e.AlgoliaAnalyticsObject = s, e.aa = e.aa || function () {
(e.aa.queue = e.aa.queue || []).push(arguments)
}, i = a.createElement(t), c = a.getElementsByTagName(t)[0],
i.async = 1, i.src = ALGOLIA_INSIGHTS_SRC, c.parentNode.insertBefore(i, c)
}(window, document, "script", 0, "aa");
// Initialize library
aa('init', {
appId: 'UJ5WYC0L7X',
apiKey: '28f0e1ec37a5e792e6845e67da5f20dd'
});</script>
<script src="/public/main-6e634771f729331a3c3c.js" defer="defer"></script>
</body></html>