@interface UIWebView(JavaScriptAlertOfUIWebView)
- (void)webView:(UIWebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(CGRect)frame;
- (BOOL)webView:(UIWebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(CGRect)frame;

@end


@implementation UIWebView(JavaScriptAlertOfUIWebView)

- (void)webView:(UIWebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(CGRect)frame {
    NSLog(@"%@",message);
    if (sender.delegate && [sender.delegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) {
        NSError *error = [[NSError alloc]init];
        [sender.delegate webView:sender didFailLoadWithError:error];
    }
//    UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"提示" message:message delegate:self cancelButtonTitle:@"ok" otherButtonTitles: nil];
//    [alertView show];



}
- (BOOL)webView:(UIWebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(CGRect)frame
{

    return YES;

}
@end

 

posted on 2017-08-15 15:05  fatal-奚山遇白  阅读(1408)  评论(0编辑  收藏  举报