lois6b
lois6b

Reputation: 184

Adapting IE8 to IE11

I have this code:

container = document.getElementById("menuContainer");

and later on:

    container.document.open("text/html");
    container.document.writeln(content);
    container.document.close();

In IE8 works but in IE11 warns me:

enter image description here

What can I do?

Upvotes: 1

Views: 138

Answers (1)

Teemu
Teemu

Reputation: 23396

The recommended standard reference from the node to a document has been node.ownerDocument since DOM Level 2. According to MDN: ownerDocument is supported since IE6. In IEs node.document was also supported until IE10.

The fix for your code would hence be:

container.ownerDocument.open(...);

document.write was used in the example only to demonstrate the output, not as real code, hence I'm not handling its use in this answer.

Upvotes: 2

Related Questions