Safari (WebKit) iframe src Bug

Download code.



iframe_test.php:

<html><head></head>
<body onload="javascript:document.forms[0].submit();">
<?php
$rand = rand(1000, 9999);
?>
<form name="form1" id="form1" method="post" 
    action="iframe_test_post.php?1=<?=$rand;?>" 
    target="target_frame">
        <input type="hidden" name="post1" value="one">
        <input type="hidden" name="post2" value="two">
</form>
<?php
$rand = rand(1000, 9999);
?>
<iframe name="target_frame" id="target_frame" 
    src="iframe_test_src.php?1=<?=$rand;?>" 
    frameborder="1">
</iframe>
</body>
</html>

iframe_test_src.php:


<?php 
ob_start();
echo "iframe_test_src.php?1=".$_GET['1']."<br><br>";
?>
Initial src content for iframe...<br>Pausing 10 seconds.<br><br> 
This is the correct content. 
An initial src is necessary in some cases as seen 
<a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;261188" 
target="_new">here</a>. 
In a moment body's onload will execute.<br>
<?php
echo str_pad('',4096)."\n";
ob_flush();
flush();
sleep(10);
ob_end_flush();
?>

iframe_test_post.php:


<?php 
ob_start();
echo "iframe_test_post.php?1=".$_GET['1']."<br><br>";
var_dump($_POST); 
if (!isset($_POST['post1']))
{
        echo '$_POST not set...<br>Pausing 10 seconds.<br><br>';
?>
This content is showing because the iframe src has been
incorrectly cached by Safari. iframe_test.src should be 
showing.  In a moment, body's onload will execute.<br>
<?php
        echo str_pad('',4096)."\n";
        ob_flush();
        flush();
        sleep(10);
}
else
{
?>
<br><br>Pressing refresh should reload iframe_test_src.php 
but it appears this page is re-loaded. In Safari, notice the 
query string will be the same and no POST will have taken place.
<?php
}
ob_end_flush();
?>