I've solved this problem for us some time ago. Bottomline is that you can't
prevent a user from leaving a certain page. Sending a form using
document.MyForm.submit() won't work. I've tried that.
Use a javascript function that is to be called in the onunload event of the
html page. In this javascript function you can have a (invisible) applet
send the form to whatever url you want. I've done this in the past and works
perfectly! Let me know if you're interested in javascript/java code samples.
Regards,
Ron van Pol
Inception VOF
P.O. Box 80
5600 AB Eindhoven
tel: +31-(0)40-2390530
fax: +31-(0)40-2390800
mobile: +31-(0)6-28942465
email: [EMAIL PROTECTED]
www: www.inception.nl
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Abhishek Vishwakarma
> Sent: Wednesday, August 08, 2001 3:48 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Browser Close (Still Problem) !!
>
>
> Hi,
>
> I tried with setting the window.location property, but didnt worked.
> Plus i tried with <BODY> tag, but the problem is the MyUnload()
> is called, but
> the form submit or servlet redirection is not happening... ???
>
> <BODY onbeforeunload='MyUnLoad()'>
>
> I will make my problem more clearer...
> I want whenever a browser window is closed a servlet should be
> called which does
> some cleaning-up/post processing operation... !!
>
>
> regards,
>
> abhishek
>
>
>
>
>
>
>
>
> yilmaz <[EMAIL PROTECTED]> on 08/29/2001 11:07:36 PM
>
> Please respond to A mailing list about Java Server Pages specification and
> reference <[EMAIL PROTECTED]>
>
>
>
> To: [EMAIL PROTECTED]
>
> cc: (bcc: Abhishek Vishwakarma/Satyam)
>
>
>
> Subject Re: Browser Close !!
> :
>
>
>
>
>
>
>
>
> Though it is not very related JSP :)
> <script>
> function testfn {
> location="the_address_of_your_servlet";
> }
> </script>
> regards
> ----- Original Message -----
> From: "Abhishek Vishwakarma" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, August 08, 2001 8:48 PM
> Subject: Browser Close !!
>
>
> > Placed At :
> >
> >
> >
> > Hi,
> >
> > Most of you must have done this...
> > Plz. can anybody tell me how to detect browser close event in
> Javascript...
> > And how to call a servlet on a Brower close...??
> >
> >
> > I tried out some thing.... but it didnt solved my purpose !
> >
> > <html>
> > <head>
> > <SCRIPT language=Javascript>
> > <!--
> > function testfn()
> > {
> > alert("Before Submit");
> > document.myfrm.action="/exam/servlet/PasswordReminderServlet";
> > document.myfrm.submit();
> > return true;
> > }
> > file://-->
> > </script>
> > </head>
> >
> > <body onUnload="testfn()">
> > <form name="myfrm" method="post">
> > Hello World
> > </form>
> > </body>
> > </html>
> >
> > ****************************************************
> > It shows the alert on window close... but my servlet is not called...
> ??????
> >
> > Plz can anybody put some light on this....!
> >
> > regards,
> >
> > abhishek
> >
> >
> ==================================================================
> =========
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets