struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kranti <kranti.j...@gmail.com>
Subject Re: BROWSER CLOSE
Date Tue, 23 Jan 2007 08:36:10 GMT
Hi,

did you meant the javascript function onunload  in <BODY> tag

if yes, i guess we will get the problem. means i just logged into
application inside the welcome page if we write onunload in BODY tag. from
welcome page i want to move to settings page then also onunload will gets
called and ask for "you really want to close the window" this should not be.
means the confirm box should not come while user navigating inside the
application. it should only come when he click on X button of browser

please suggest


On 1/23/07, bjorn.de.bakker@accenture.com <bjorn.de.bakker@accenture.com>
wrote:
>
> Use window.onunload or windows.unload or sth like that.
>
> -----Original Message-----
> From: Kranti [mailto:kranti.j2ee@gmail.com]
> Sent: dinsdag 23 januari 2007 9:04
> To: user@struts.apache.org
> Subject: BROWSER CLOSE
>
> Hi Guys,
>
> I am working on a struts based application. I need to meet a special
> requirement that is when user clicks the X button on the browser the
> browser
> should not close immediately rather we should show a confirm box. if user
> says yes in the confirm box then only browser should close.
>
> i am trying with the following code
>
> <html><head>
> <script>
> function doUnload()
> {
> if (window.event.clientX < 0 && window.event.clientY < 0)
> {
> var answer=confirm("Window is closing...");
> if (answer){
>   alert("Bye bye!");
>   return true;
>   //window.close();
> }
> else{
>
>   alert("Thanks for sticking around!");
>   return false;
> }
> }
> }
> </script>
> </head>
> <body onunload="return doUnload();">
> <a href="http://www.google.com">google</a>
> </body></html>
>
>
> but no luck able to see the confirm box but the window is getting closed .
>
> Please suggest some idea
>
> Thanks
> Kranti
>
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information.  If you have
> received it in error, please notify the sender immediately and delete the
> original.  Any other use of the email by you is prohibited.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message