Hidden Iframe

This example shows how you can reference elements and/or run functions in a hidden page.
The trick is to load the page into a hidden iframe, you can then reference any known element or function that is in the page loaded into the hidden iframe.

Load Page 1 Get Body Content
Get Div Content
Run Function

 

If you are going to reference different pages in the hidden iframe the function must first check that the correct page is loaded.
These simple statements will check that the name of the page, pageName, is the correct page.

currentPage=window.frames['iframe_name'].location.toString()
if(currentPage.indexOf("pageName.htm")!=-1){
do this
}

Where pageName is the name of your page

Load Page 2 Get Div Content
Load Page 3 Run Function

 

Although the ideal attribute to use is display:none, which works in IE, Mozilla, and Firefox, NS7 throws its toys out of its pram if display:none is used so it is best to use visibility:hidden and move the iframe offpage.

<iframe name="myname" src="blank.htm" style="position:absolute;left:0px;top:-500px;visibility:hidden"></iframe>