- (void)webView:(WKWebView*)webViewdecidePolicyForNavigationAction:(WKNavigationAction*)navigationActiondecisionHandler:(void(^)(WKNavigationActionPolicy))decisionHandler {
NSString*urlStr = navigationAction.request.URL.absoluteString;
if([urlStrhasPrefix:@"alipays://"] || [urlStrhasPrefix:@"alipay://"]) {
NSURL*alipayURL = [NSURLURLWithString:urlStr];
NSLog(@"%@",alipayURL);
if(@available(iOS10.0, *)) {
[[UIApplication sharedApplication] openURL:alipayURL options:@{UIApplicationOpenURLOptionUniversalLinksOnly: @NO} completionHandler:^(BOOL success) {
NSLog(@"跳转支付宝");
}];
}else{
// Fallback on earlier versions
[[UIApplicationsharedApplication]openURL:alipayURL];
}
}
decisionHandler(WKNavigationActionPolicyAllow);
}