JS端方法
<pre>
function open()
{
if (browser.versions.ios)
{
window.open("open://" + encodeURIComponent("让阅读产生价值,让更多人得到帮助,领读与你,有福同赏!我的邀请码是"), "_blank");
}
}
</pre>
OC端 实现UIWebViewDelegate委托方法
<pre>
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if([request.URL.scheme isEqualToString:@"open"])
{
NSString *params= request.URL.host;
//params 为传递过来的参数
NSLog(@"%@",params);
}
return YES;
}
</pre>