When embedding WebView in an application and loading html-pages in it, JavaScripts alert()
/confirm()
/etc. do not work.
Looking around in th
It turns out there is simply no default WebUIDelegate
set - Apple seems to expect everyone to implement the same basic features for themselves.
Here is a sample code that will do the basic job. You need however to make sure that this object is registered as a UIDelegate for the WebView.
- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
NSAlert *alert = [[NSAlert alloc] init];
[alert addButtonWithTitle:@"OK"];
[alert setMessageText:message];
[alert runModal];
[alert release];
}