...

View Full Version : How to Load Whole Website's HTML Code Into Innerhtml?



dealmaker
08-15-2005, 03:27 AM
Hi,
I have a iframe with name and id, and I have a internal html page in my server. This internal html page has all the components(like header, title, the <html> tag, etc) that can be a standalone page. I get the internal page using php code. The whole thing is using AJAX.

I try to load this internal page into my iframe.

The following is the code:

In my webpage:

<iframe name="myframe" id="myframe" width="800" height="800"></iframe>


In my javascript:

var myframe = document.getElementById('myframe');
myframe.innerHTML= xmlHttp.responseText;

I checked xmlHttp.responseText, and verified that it contain the whole internal page in html page as text. btw, the html code is quite big, it has 20000 characters. But iframe just don't show the internal page in the browser. Why? How do I fix it?

Many thanks.

martin_narg
08-15-2005, 04:09 AM
the iframe does not have an innerHTML property - hence the problem. However why not just load the page into the iframe to display the html?


document.getElementById("myframe").src = "internalHTMLpage.html";


Hope this helps

m_n

dealmaker
08-15-2005, 04:27 AM
It's because I need to traverse the dom tree of the content in the iframe. I can't do that because of javascript security limitation. I will have 2 different domains, and I need to sync the content in the iframe of one domain with the other domain.

Any way to go around the innerhtml thing? I don't have to use iframe. All I want is to be able to traverse the dom tree of the content from responseText.



the iframe does not have an innerHTML property - hence the problem. However why not just load the page into the iframe to display the html?


document.getElementById("myframe").src = "internalHTMLpage.html";


Hope this helps

m_n

martin_narg
08-15-2005, 04:40 AM
http://www.codingforums.com/showthread.php?t=64218

m_n



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum