你得h5界面的按钮点击实现方法
window.location.href = "协议名:其他啥啥";
window.location.href = "ios:back";
然后你在你的webview代理方法
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSString *requestString = [[request URL] absoluteString];
requestString = [requestString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
if( navigationType == UIWebViewNavigationTypeOther ) {
if ([requestString hasPrefix:@"ios:"]) {
//开始处理你的逻辑,你想跳转怎么跳转 你自己控制呗
//比如我处理跳出webview
[self.navigationController popViewControllerAnimated:YES];
return NO;
}
}
return YES;
}
网友评论