Created
December 12, 2013 14:19
-
-
Save hallvors/7928615 to your computer and use it in GitHub Desktop.
Test case for SUMO issue 975037
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head><title>document.write and the back button</title></head> | |
<body> | |
<p>FAILED (not ran)</p> | |
<iframe src="./"></iframe> | |
<script> | |
// there is something odd with document.write() and IFRAME | |
// one immediately, inline | |
writeIframe('1st time - inline'); | |
// one from onload handler | |
window.onload = function(){ | |
writeIframe('2nd time(?) - onload'); | |
} | |
// and one after onload | |
setTimeout(function(){ | |
writeIframe('3rd time - timeout'); | |
document.getElementsByTagName('p')[0].textContent += ' history.length: '+history.length | |
},1200); | |
function writeIframe(str){ | |
var ifr = document.getElementsByTagName('iframe')[0]; | |
ifr.contentDocument.open(); | |
ifr.contentDocument.write('<html><p>document.write("'+str+'")</p></html>'); | |
ifr.contentDocument.close(); | |
} | |
document.getElementsByTagName('p')[0].textContent = 'How many times do you need to click the back button here?'; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment