Kenneth J
Kenneth J

Reputation: 4896

Problem displaying content added from parent window to child window in Firefox

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?

Upvotes: 1

Views: 242

Answers (1)

ithcy
ithcy

Reputation: 5589

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

Upvotes: 3

Related Questions