Created
November 20, 2009 02:30
-
-
Save saikat/239237 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setDocument:(CPDocument)aDocument | |
{ | |
if (aDocument === _document) | |
return; | |
[super setDocument:aDocument]; | |
var unloadFunction = function() { | |
if ([_document isDocumentEdited]) { | |
return "Your document has unsaved changes. If you leave, you will lose any unsaved changes to your document."; | |
} | |
}; | |
if (document.attachEvent) | |
[[self window] platformWindow]._DOMWindow.attachEvent("onbeforeunload", unloadFunction); | |
else | |
[[self window] platformWindow]._DOMWindow.onbeforeunload = unloadFunction; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment