[thelist] Printing an iframe

Scott Brady evolt at scottbrady.net
Tue Oct 21 15:05:48 CDT 2003


Does printing an iframe work the same as printing a frame?

Here's the scenario (it's a protected site, so I don't have a URL to share):

I have a page ["A"] where pressing a "Print" form button loads content in an invisible iframe ["B"] located in page A.  When the iframe page loads, it calls a function in page A (the parent) that is supposed to print the iframe content.

I've looked in the archives, and assuming iframes work like frames in this case, the following code SHOULD work. However, it's printing the main page ["A"] instead. 

Here's the print function:

function printFrame()
{
	var pp = frames['PageProcessing'];
alert(pp.location.href);
	pp.focus();
	pp.print();
}

I've verified (with that alert) that the URL in the iframe is correct.

I'm testing in IE5.5 on Win2k.

Scott
----------------------------
Scott Brady
http://www.scottbrady.net/




More information about the thelist mailing list