These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

closing a PDF doc with javascript

cmizelle
Registered: Mar 19 2007
Posts: 2

Hello. I have a question regarding closing a window that has been programatically populated with a PDF document via javaScript.
 
Example:
I have some code that opens a popup window and populates it with a pdf document...
 
var popupWin = window.open("url/doc.pdf", "popup", "width=600,height=400");
 
Then, somewhere else in the code I am trying to close the window with:
 
popupWin.close();
 
The close method call does not actually close the window. If I look at the closed attribute of the popupWin object it returns true. So, the browser thinks the window is closed but it is not.
 
This code all works fine if I load an HTML page into the popup window but fails when I load a PDF document into the window.
 
Any help would be appreciated.
 
Thanks,
Chris Mizelle
[link=mailto:chrismizelle [at] cox [dot] net]chrismizelle [at] cox [dot] net[/link]

My Product Information:
Reader 8, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Acrobat is keeping the window open. Since your second strategy seems to be working you should go with it.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script