how to print this iframe

DewChugr

Photoshop God
Jun 26, 2006
1,977
66
0
48.655139,-119.644032
I have a basic web page with various DIVs, inside one I have an iframe from a different server, that I don't have access to. I want to be able to print only the contents of the iframe.

When the user visits the page and the iframe loads they selects searches an item they want details on, the results are generated and displayed in the iframe, the iframe url remains the same.

Any way to do this? I've had no luck so far. I'd be happy if I could open the iframe in a new tab, but it would have to not reload the content. Must work in IE and firefox, safari and opera as a bonus.

possible or screwed?
 


It sounds like it's POSTing data (since the frame url stays the same) instead of using a GET variable.

You can test to see if that's the case using something like live headers in firefox. If so, copy and paste the post variables into something like Browser Simulator/Emulator Tool, Web Page Tester, URL Source/Headers Viewer (a form post simulator).... if it works, you can easily whip up a php solution for your printing needs.
 
sounds like you'll need to grab the form via php, might have to muck with the output, then either put that in the iframe, or inline in the div, making sure you change the form to use JS to pop the submit into a new tab..

It hinges on weather they check IP/cookies or not against the get request on the post.
 
StackOverflow says this works:

Code:
window.frames["printme"].focus();
window.frames["printme"].print();

I'm thinking that wont work cross-domain, but as mentioned on that page, a print stylesheet is a way of doing this, style the page in a print only stylesheet to hide everything but the iframe, which would be max width/height.