Re: <body onload="window.print(); window.close();">
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: <body onload="window.print(); window.close();">

From: VK <schools_ring@yahoo.com>
Date: Sat Dec 24 2005 - 14:19:52 CET

stephen@ploughbooksales.com.au wrote:
> I have created an order form that users javascript to create a new html
> document when the customers clicks the "print page" button.
>
> Once the new document has been created it then prints the document and
> closes it with the following code:
>
> <body onload="window.print(); window.close();">
>
> This works correctly (or at least the way I expect it to work under MS
> Internet Explorer, but it cuases Netscape to "crash"
>
> Does anyone have an explanation as to why?

window.print() is not a *process*, it is simply a request to display
print dialog (same as choosing File > Print). Therefore ideas of sync /
async are not applicable here.

IE has full set of event listeners to fine tune the printing *process*:
 onlayoutcomplete
 onberoreprint
 onafterprint

Unfortunately these listeners still have to be implemented by the
wannabes. Untill then it is better to leave the content window open.
Received on Tue Jan 3 03:54:12 2006