+- (BOOL) webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
+ UIActionSheet *sheet = [[[UIActionSheet alloc]
+ initWithTitle:@"JavaScript Confirm"
+ buttons:[NSArray arrayWithObjects:@"OK", @"Cancel", nil]
+ defaultButtonIndex:0
+ delegate:self
+ context:@"confirm"
+ ] autorelease];
+
+ [sheet setNumberOfRows:1];
+ [sheet setBodyText:message];
+ [sheet popupAlertAnimated:YES];
+
+ NSRunLoop *loop([NSRunLoop currentRunLoop]);
+ NSDate *future([NSDate distantFuture]);
+
+ while (confirm_ == nil && [loop runMode:NSDefaultRunLoopMode beforeDate:future]);
+
+ NSNumber *confirm([confirm_ autorelease]);
+ confirm_ = nil;
+ return [confirm boolValue];
+}
+