Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / July 2003

Tip: Looking for answers? Try searching our database.

how do i close the browser from a servlet ?

Thread view: 
Max - 29 Jul 2003 16:06 GMT
is there a quick way to close the browser from a servlet ?

for the moment, when the user clicks on QUIT, I do a redirection to another
html page

Redirection redirection =  new Redirection("/index.html");
return redirection;

How do i just close the browser, without any redirection ?.
thanks
Max - 29 Jul 2003 16:41 GMT
close.html :
<html>
<body onLoad="window.close()">
</body>

Servlet :
Redirection redirection =  new Redirection("/close.html");

this would work perfectly but then i need to add an html file to my webapp,
i don't want that ..
> is there a quick way to close the browser from a servlet ?
>
[quoted text clipped - 6 lines]
> How do i just close the browser, without any redirection ?.
> thanks
G - 29 Jul 2003 16:49 GMT
You don't need your extra file if you write "raw" html from your servlet:

public void doPost(HttpServletRequest req, HttpServletResponse resp) {
    OutputStream out = req.getOutputStream();
    out.write("<html>");
    out.write("<body onLoad='window.close();'>");
    out.write("</html>");
    out.close();
}

(i've not tried the code above, but that is the idea)
Regards,
Guido

> close.html :
> <html>
[quoted text clipped - 20 lines]
>>How do i just close the browser, without any redirection ?.
>>thanks


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.