View Full Version : child window & print option
I have created one print link to print the page onclick of which i am calling chilld window to print with print dilogue box.
Now what I want is, if the user click cancel on that print dilogue box the window should close with print dilogue box.?
glenngv
11-26-2002, 07:45 AM
as far as I know, javascript can't determine if the user chooses print or cancel
Is there any other way to determaine...
glenngv
11-26-2002, 09:18 AM
as far as i know, there is none. But even if there is a way, I would prefer not to auto-close the window. You don't know what the user prefers, maybe he wants to cancel the printing to see first what the page look like.
I got the functionality which i want in this url
http://infotech.indiatimes.com/cms.dll/xml/comp/articleshow?artid=28861382
at the bottom article there is link of Print This Page.
But i did not understand how they done this?
glenngv
11-27-2002, 05:24 AM
you can view-source even if the Print dialog box is open.
This is their code:
<script language="javascript">
var i;
window.print();
setTimeout('window.close()',500);
</script>
That will close the window even if the user chooses Print or Cancel.
In my given url they are not closing window after certain time.
I checked there code but it's quite difficult to understand what they have done?
:(
glenngv
11-28-2002, 08:11 AM
I've shown you THEIR code in my previous post. Did you try it?
after long time
It's working fine I tried it today
Thanks glenngv
one more query regarding this question :
<script language="javascript">
var i;
window.print();
setTimeout('window.close()',500);
</script>
I want to open it on click only not onload :
function xyz()
{
var printPage = window.open(xyz.htm);
printPage.blur();
printPage.print();
setTimeout(printPage.close(),600);
}
calling this function onclick. It is working onlything throwing error invalid argument setTimeout
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.