Connecting Tech Pros Worldwide Forums | Help | Site Map

confirm closing web page

Fabrizio
Guest
 
Posts: n/a
#1: Jul 20 '05
I've this problem.
I need, when the user close the web page, to show a message of confirm with
Ok and cancel.
With the event unload when I click cancel the web page closes however.
What can I do ?
Sorry for the bad English.
Hello.



Fabrizio
Guest
 
Posts: n/a
#2: Jul 20 '05

re: confirm closing web page


I found,
thanks

<SCRIPT LANGUAGE="JavaScript" EVENT="onbeforeunload()" FOR="window">
event.returnValue = "Chiudi questa finestra ! Sei sicuro?";
</SCRIPT>


"Fabrizio" <fabrizio.crespi@atenait.it> ha scritto nel messaggio
news:7qzQa.173996$lK4.4928413@twister1.libero.it.. .[color=blue]
> I've this problem.
> I need, when the user close the web page, to show a message of confirm[/color]
with[color=blue]
> Ok and cancel.
> With the event unload when I click cancel the web page closes however.
> What can I do ?
> Sorry for the bad English.
> Hello.
>
>[/color]


point
Guest
 
Posts: n/a
#3: Jul 20 '05

re: confirm closing web page


I think that onbeforeunload() event will only work with IE!

But not sure on that info...anybody!??

Respect...

p.

"Fabrizio" <fabrizio.crespi@atenait.it> wrote in message
news:DNzQa.173469$Ny5.4927603@twister2.libero.it.. .[color=blue]
> I found,
> thanks
>
> <SCRIPT LANGUAGE="JavaScript" EVENT="onbeforeunload()" FOR="window">
> event.returnValue = "Chiudi questa finestra ! Sei sicuro?";
> </SCRIPT>
>
>
> "Fabrizio" <fabrizio.crespi@atenait.it> ha scritto nel messaggio
> news:7qzQa.173996$lK4.4928413@twister1.libero.it.. .[color=green]
> > I've this problem.
> > I need, when the user close the web page, to show a message of confirm[/color]
> with[color=green]
> > Ok and cancel.
> > With the event unload when I click cancel the web page closes however.
> > What can I do ?
> > Sorry for the bad English.
> > Hello.
> >
> >[/color]
>
>[/color]


ManoDestra
Guest
 
Posts: n/a
#4: Jul 20 '05

re: confirm closing web page


If you want to manually control the close via a link on your page then just
write a function that will do that.

function confirmClose() {
if (confirm("Are you sure that you want to close this window?")) {
top.close();
//or self.close();
}
}

If you want to capture a user clicking on the close icon in the top right of
a browser such as IE or NetScape, then I don't know how you would capture
this via JavaScript.

Peter.
"point" <info@caanproduction.com> wrote in message
news:beunjq013pp@enews2.newsguy.com...[color=blue]
> I think that onbeforeunload() event will only work with IE!
>
> But not sure on that info...anybody!??
>
> Respect...
>
> p.
>
> "Fabrizio" <fabrizio.crespi@atenait.it> wrote in message
> news:DNzQa.173469$Ny5.4927603@twister2.libero.it.. .[color=green]
> > I found,
> > thanks
> >
> > <SCRIPT LANGUAGE="JavaScript" EVENT="onbeforeunload()" FOR="window">
> > event.returnValue = "Chiudi questa finestra ! Sei sicuro?";
> > </SCRIPT>
> >
> >
> > "Fabrizio" <fabrizio.crespi@atenait.it> ha scritto nel messaggio
> > news:7qzQa.173996$lK4.4928413@twister1.libero.it.. .[color=darkred]
> > > I've this problem.
> > > I need, when the user close the web page, to show a message of confirm[/color]
> > with[color=darkred]
> > > Ok and cancel.
> > > With the event unload when I click cancel the web page closes however.
> > > What can I do ?
> > > Sorry for the bad English.
> > > Hello.
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


HikksNotAtHome
Guest
 
Posts: n/a
#5: Jul 20 '05

re: confirm closing web page


In article <lU%Sa.3050$D67.347721@newsfep1-win.server.ntli.net>, "ManoDestra"
<manodestra.software@ntlworld.com> writes:
[color=blue]
>If you want to capture a user clicking on the close icon in the top right of
>a browser such as IE or NetScape, then I don't know how you would capture
>this via JavaScript.[/color]

Post
Top
Dont
Please

You can't detect how I left a page other than your mentioned script. Other than
that, you have no way of knowing if I closed the browser, clicked a favorite,
typed a URL in, only that I left.
--
Randy
All code posted is dependent upon the viewing browser
supporting the methods called, and Javascript being enabled.
Closed Thread