Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2012
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Smile Google Chrome doesn´t support iframe innerHTML?

    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

  • #2
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    May 2012
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts
    It stil says "Cannot read property 'body' of undefined"... Any other ideas?

  • #4
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by vilhelm View Post
    It stil says "Cannot read property 'body' of undefined"... Any other ideas?
    Full code or URL please.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •