Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/embedded-content/the-audio-element/audio-loading-eager.tentative.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<link rel="author" title="Squarespace" href="https://www.squarespace.com/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
.below-viewport {
margin-top: 1000vh;
}
</style>
<body>
<script>
async_test(t => {
const audio = document.createElement("audio");
audio.id = "below_viewport";
audio.className = "below-viewport";
audio.src = "/media/sine440.mp3?pipe=trickle(d2)";
audio.loading = "eager";
audio.controls = true;
audio.addEventListener("loadeddata", () => {
t.done();
});
document.body.appendChild(audio);
t.step_timeout(() => {
assert_unreached("Eager audio should load data immediately");
}, 5000);
}, "Audio with loading='eager' loads immediately regardless of viewport position");
</script>
</body>