Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-nav-meta-refresh.optional.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Navigating iframe loading='lazy' before it is loaded: meta refresh</title>
<!-- This test is optional because the spec allows delaying or doing nothing for meta refresh. -->
<iframe src="support/blank.htm?src" loading="lazy" hidden></iframe>
<script>
const iframe = document.querySelector('iframe');
const iframeLoaded = new Promise(resolve => {
iframe.onload = resolve;
});
const meta = iframe.contentDocument.createElement('meta');
meta.httpEquiv = 'Refresh';
meta.content = '0; url=support/blank.htm?nav';
iframe.contentDocument.head.append(meta);
iframe.hidden = false;
</script>
<!-- Loading testharness.js here is intentional to reproduce a bug in WebKit. -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({single_test: true});
iframeLoaded.then(() => {
// Need a timeout to detect failure when there are two navigations.
step_timeout(() => {
assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?nav", location.href).href);
done();
}, 1000);
});
</script>