...

View Full Version : Google Chrome doesn´t support iframe innerHTML?



vilhelm
05-27-2012, 07:57 PM
Hi!
Google Chrome acts strange when my javascript function should open this iframe.

It works perfect in Internet Expolorer, but when I open it in Google Chrome it alert "Cannot read property 'body' of undefined".

This is the code that works in Internet Explorer, but not in Google Chrome:

window.frames["nameOfFrame"].document.body.innerHTML

What is wrong, doesn´t Google Chrome support iframe from innerHTML?

I will be very happy if anyone of you can help me :)

/ Vilhelm

Logic Ali
05-27-2012, 08:09 PM
The iframe should have an ID.

document.getElementById( 'iframeID' ).contentWindow.document.body.innerHTML

Make sure you don't execute such code until the iframe's document has loaded.

vilhelm
05-27-2012, 09:13 PM
It stil says "Cannot read property 'body' of undefined"... Any other ideas? :)

Logic Ali
05-27-2012, 11:47 PM
It stil says "Cannot read property 'body' of undefined"... Any other ideas? :)
Full code or URL please.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum