File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Closing a pop up window of Excel on cancel. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Closing a pop up window of Excel on cancel." Watch "Closing a pop up window of Excel on cancel." New topic

Closing a pop up window of Excel on cancel.

Rahul Babbar
Ranch Hand

Joined: Jun 28, 2008
Posts: 210

I am a bunny in Javascript and i am having an issue here which i dont have any idea.

In the code, this javascript function is written which opens up an excel sheet.

Now when the excel opens up in the browser, a small browser window2 opens(without any data) and another popup comes, which asks the user whether you want to save or open or cancel.
if we select Open, the data is populated in the window2 in the form of excel.
However, if we select 'save' or 'Cancel', the popup closes but the browser window2 remains open.
My requirement is to close the window2 excel sheet when Save or Cancel is clicked.

Any ideas?

Rahul Babbar
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
I do not think there is anything you can do about it because the browser is handing off the operation to excel and Escel does what it wants to do.

You might be better off setting the window.location.href to the file and see how the other browsers handle it.

Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Do not open a new window. Just use a plain vanilla link to the servlet and set the content disposition to 'attachment' in the servlet.
I agree. Here's the link:
subject: Closing a pop up window of Excel on cancel.
It's not a secret anymore!