Meaningless Drivel is fun!*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Close browser window" Watch "Close browser window" New topic
Author

Close browser window

Rakesh Gadre
Ranch Hand

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

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

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
Bartender

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: http://aspose.com/file-tools
 
subject: Close browser window
 
Similar Threads
How to download csv file
problem with download file using struts
Opening xls file in html
File output format
Force a file download in HTML