Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

close window after print

Status
Not open for further replies.

mhamilton3

Programmer
Oct 31, 2001
129
Hello,
I have what seems like a simple questions, but I can not find the solution. I want to popup a window, print the window, and close down the window once the print / cancel print has happended. I do not have a problem poping it up, or printing it, but it is the closing it down that is a little goofy. The code is simply.

window.print();
opener.focus();

The parent program has code that closes the child as soon as the parenet comes into focus. The problem is the screen pops up, then it goes away and comes back up with the print dialog box. The flash of the screen does not make any sense to me. It does print and then go away, but I don't like the flash.

I used to have

window.print();
window.close();

but that did not work on the MAC (OS 10.2) with IE 5.2. I will try anything. Thanks
 
You're getting the flash because the browser is quicker than the print command in the system. As soon as the browser sends the print command to the system, it moves on and focuses on the parent. Then when the print command gets around to opening, it has to go back to the child window so it can print that page. It's not a very good solution, but you might try setting the opener.focus() command on a time delay so that it closes the window say after 10 seconds or something like that to give the print command enough time to execute.
 
thanks, I thought of that one and agree it is not a clean solution, but if it works, it works. Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top