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/browsers/browsing-the-web/navigating-across-documents/navigate-cross-origin-iframe-to-same-url-with-fragment.html - WPT Dashboard Interop Dashboard
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<body>
<script>
async_test(t => {
let starting_history_length = history.length;
let cross_origin_url = new URL(get_host_info().HTTPS_REMOTE_ORIGIN);
cross_origin_url.pathname = "/common/blank.html";
cross_origin_url.hash = "#foo";
let i = document.createElement("iframe");
i.src = cross_origin_url;
document.body.appendChild(i);
window.onload = () => t.step_timeout(() => {
assert_equals(starting_history_length, history.length);
i.src = cross_origin_url;
// Give the navigation time to happen - no events will fire.
t.step_timeout(() => {
assert_equals(starting_history_length + 1, history.length);
t.done();
}, 100);
}, 0);
}, "Navigating a cross-origin iframe to its current url should not replace");
</script>
</body>