I have created a view that loads another view asynchronously and then replaces the current one using document.write (yes, I want to replace the whole page!):
$.ajax({
type: "GET",
url: myUrl,
data: null,
async: true,
success: function (result) {
document.close();
document.open();
document.write(result);
document.close();
},
error: function (req, status, error) {
$("#loading-div").html("error");
}
});
The content includes a full view with its own scripts and CSS styles. While everything works fine in IE or Chrome, loading the page in Firefox results in the loaded page via document.write not functioning properly - especially some of the scripts (some work, some don't).
I cannot use innerHTML because of scripts that are not evaluated.
Why is it not working properly only in Firefox (when even IE can handle it)?