\n<head>\n <title>test</title>\n</head>\n<body>\nHello, world.
\nHere\n<script>\n document.location.hash = "#foo";\n</script>\n
It breaks in Safari, because navigating to the bookmark in JavaScript causes it to reload the page, encountering the JavaScript causing it to reload the page, etc.
Cheers,
Ben