Custom Cocoa WebView JavaScript Confirm Window


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. - (BOOL)webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
  2. NSInteger result = NSRunInformationalAlertPanel(NSLocalizedString(@"JavaScript", @""), // title
  3. message, // message
  4. NSLocalizedString(@"OK", @""), // default button
  5. NSLocalizedString(@"Cancel", @""), // alt button
  6. nil);
  7. return NSAlertDefaultReturn == result;
  8. }

URL: http://github.com/marshall/titanium/blob/292086a450efae607c9c5e54db03b2bcb94252b4/runtime/webkit_shell/osx_new/src/TIBrowserWindowController.m

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.