From 97212073ead73e0795aa1f82b41767b5a3d99031 Mon Sep 17 00:00:00 2001 From: duwen Date: Tue, 12 Dec 2017 14:47:39 +0800 Subject: [PATCH] add shouldStartLoadWithRequest method to WebEventDelegate --- dsbridge/DUIwebview.m | 6 +++++- dsbridge/JSBWebEventDelegate.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dsbridge/DUIwebview.m b/dsbridge/DUIwebview.m index dcac62d..7395ec0 100644 --- a/dsbridge/DUIwebview.m +++ b/dsbridge/DUIwebview.m @@ -94,7 +94,11 @@ -(instancetype)initWithFrame:(CGRect)frame -(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { - return YES; + if([WebEventDelegate respondsToSelector:NSSelectorFromString(@"shouldStartLoadWithRequest::")]){ + return [WebEventDelegate shouldStartLoadWithRequest:request :navigationType]; + }else{ + return YES; + } } - (void)webView:(UIWebView *)webView didCreateJavaScriptContext:(JSContext *)ctx diff --git a/dsbridge/JSBWebEventDelegate.h b/dsbridge/JSBWebEventDelegate.h index 0ef9d84..970d92c 100644 --- a/dsbridge/JSBWebEventDelegate.h +++ b/dsbridge/JSBWebEventDelegate.h @@ -14,5 +14,6 @@ CF_ASSUME_NONNULL_BEGIN - (void) onPageStart:(NSString *)url; - (void) onpageFinished:(NSString *)url; - (void) onpageError:(NSString *)url :(NSString *) msg; +- (BOOL) shouldStartLoadWithRequest:(NSURLRequest *)request :(UIWebViewNavigationType)navigationType; @end CF_ASSUME_NONNULL_END