confirm closing web page

F

Fabrizio

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.
 
F

Fabrizio

I found,
thanks

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

point

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

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

Respect...

p.
 
M

ManoDestra

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,077
Messages
2,570,566
Members
47,202
Latest member
misc.

Latest Threads

Top