Load the following example in different browsers.
<!DOCTYPE html>
<html>
<body>
<a onclick='document.write("text <a href=\"#a\">link</a>");document.close();'>click</a>
</body>
</html>
When the page is loaded click the link. Doing this will rewrite the page using document.write which will contain an anchor named "link".
In IE8, IE9, Chrome latest when this link is clicked it will not lead to page load.
In Firefox (tested with latest and FF6) clicking the link reloads the original page.
Firefox behavior seems to be incorrect as using anchors should not lead to page loads. If document write is not used clicking on anchors won't lead to page load even in Firefox.
Is there a workaround for this?
The goal would be to use document.write. This sample just simulates that we'd like to load another complete webpage including lot of javascript code with AJAX which needs to run properly after the inclusion.