<!DOCTYPE html>
<html>
<body>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.dumpChildFramesAsText();
    testRunner.waitUntilDone();
    testRunner.dumpBackForwardList();
}
    
onload = function()
{
    if (sessionStorage.didNav) {
        delete sessionStorage.didNav;
        delete sessionStorage.topShouldNavAndGoBack;
        if (window.testRunner) {
            // Wait until the iframe is showing the POST response before ending the test.
            let el = document.getElementById('target-frame');
            if (el.src !== 'about:blank' && el.readyState === 'complete') {
                testRunner.notifyDone();
                return;
            }

            el.onload = function() {
                if (el.src !== 'about:blank')
                    testRunner.notifyDone();
            };
        }
    } else {
        sessionStorage.topShouldNavAndGoBack = true;
        document.getElementById('the-form').submit();
    }
}
   
</script>  

<p>Tests that a POST targetted to a frame is handled correctly when navigating away and coming back to the page.</p>

<form id="the-form" method="POST" action="resources/form-target.pl" target="target-frame">
  <input name="the-input" value="input value goes here">
</form>

<iframe id="target-frame" name="target-frame" src="about:blank"></iframe>
</body>
</html>