my dog learned polymorphism
The moose likes JSP and the fly likes Close browser window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Close browser window" Watch "Close browser window" New topic

Close browser window

Rakesh Gadre
Ranch Hand

Joined: Feb 22, 2003
Posts: 47
I am using a jsp file to open an excel file by using the following Syntax:

String fileName = (String)session.getAttribute("fileName");
<meta http-equiv="refresh" content="0;URL=<%=fileName%>">

This code opens up a dialog box that prompts user to OPEN/SAVE the file.

Now, my requirement is that if user saves the file, I want to close the browser window automatically... if he opens it, nothing should happen..

Thanks in advance
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

To do that you'd have to change some setting in the client OS most probably. It certainly can't be done with any code in the JSP, and I don't think it can be done with JavaScript either. I don't think its worth the effort trying this - I'd go argue the requirement with who ever set it.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: Close browser window
It's not a secret anymore!