Question - Setting dynamic HTML using Javascript to iFrames on Windows Mobile 6.1 - IE Mobile6

Posted by swaroop on Stack Overflow See other posts from Stack Overflow or by swaroop
Published on 2010-05-18T09:18:12Z Indexed on 2010/05/18 9:20 UTC
Read the original article Hit count: 466

Hi Experts, (excuse me if this is not the right forum to post - i couldn't find anything related to non-native programming and related to this topic)

I Am trying to set a dynamic HTML into an iFrame on the webpage. I have tried a couple of things but none of them seem to work. I m able to read the innerHTML but can't seem to update it.

// Able to read using 
document.getElementById('iFrameIdentifier').innerHTML;

// On Desktop IE, this code works 
document.getElementById('iFrameId').contentWindow.document.open();
document.getElementById('iFrameId').contentWindow.document.write(dynamicHTML);
document.getElementById('iFrameId').contentWindow.document.close();

Ideally the same function should work as how it works for div's but it says 'Object doesn't support this method or property".

I have also tried document.getElementById('iFrameId').document.body.innerHTML.

This apparently replaces the whole HTML of the page and not just the innerHTML.

I have tried out a couple of things and they didn't work

  • document.getElementById('iFrameId').body.innerHTML
  • document.frames[0].document.body.innerHTML

My purpose is to have a container element which can contain dynamic HTML that's set to it.

I've been using it well till now when I observed that the setting innerHTML on a div is taking increasing amount of time because of the onClicks or other JS methods that are attached to the anchors and images in the dynamic HTML. Appears the JS methods or the HTML is some how not getting cleaned up properly (memory leak?)

Also being discussed - http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_26185526.html#a32779090

© Stack Overflow or respective owner

Related posts about windows-mobile-6.1

Related posts about iframe