Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preventing close

Status
Not open for further replies.

mcowen

Programmer
Joined
Oct 21, 2001
Messages
134
Location
GB
Hi,
I would like to ask the user whether he wants to proceed with the close because otherwise I will close all child windows. I cant stop the main window closing when I click the close box. Is there a way of stopping it? At present it closes then I get the confirm dialog and of course by this stage its too late.

Thanks
Matt
 
sorry. its a case of doing a proper search....heres the answer:

window.onbeforeunload = unloadAnnounce;
function unloadAnnounce(){
if (typeof(caseSummaryWindow) != "undefined"){
Announce = "This will close the summary page. Are you sure you want to close?"
return Announce;
}
else {
Announce = "Are you sure you want to close?"
return Announce;
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top