Skip to content

Instantly share code, notes, and snippets.

@jansepar
Created November 8, 2013 18:13
Show Gist options
  • Save jansepar/7375182 to your computer and use it in GitHub Desktop.
Save jansepar/7375182 to your computer and use it in GitHub Desktop.
Minimal testcase that causes anchor tags to behave in non-standard ways in Firefox when recreating the document using document.open/document.write.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Link href minimal testcase</title>
</head>
<body class="foo">
<script>
setTimeout(function(){
document.open();
document.write('<html><head></head><body><a href="#">Click me! I should\'t cause a reload...</a></body></html>');
document.close();
}, 200)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment