views:

37

answers:

1

Here is the code I am using to create and add content to a new window via JavaScript:

        var newWindow = window.open();
    newWindow.document.title = "This is my new window";
    newWindow.document.body.innerHTML = "<center>This is content added from the parent window</center>";

This works in every browser I have tested except Firefox. When I open firebug it shows the html added from the parent but it is not displaying it on the page?
Am I doing something wrong?

+3  A: 

Use newWindow.document.write() instead of newWindow.document.body.innerHTML = "".

ithcy