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