I have the following code:
<html>
<head>
</head>
<body>
<script type="text/javascript">
var frame = document.createElement('iframe');
frame.id = 'myFrame';
document.getElementsByTagName('body')[0].appendChild(frame);
var context = frame.contentWindow.document;
context.body.innerHTML = 'testing';
</script>
</body>
</html>
This creates a simple iframe containing my text: ‘testing’.
This works perfectly in Chrome, but Firefox and IE are rendering an empty iframe.
Any idea what I’m doing wrong?
You can do something like this:
Javascript is interpreted differently by all browsers, so it’s just a matter of using the common-approach. This should work across all browsers.
Give it a try.