Cordova方法

作者: gxatios | 来源:发表于2016-06-08 10:58 被阅读89次

一,Js与oc交互

方法1,拦截请求;方法2,拦截页面跳转


方法1,js使用 XMLHttpRequest 发起请求,拦截方法

+ (BOOL)canInitWithRequest:(NSURLRequest*)theRequest 分析

方法2,cordova用一个透明的frame作为webview加载request,拦截方法

- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType

二,oc->js

发送js命令 [webView stringByEvaluatingJavaScriptFromString:@"alert('hello world!')【js语法】"];

相关文章

网友评论

    本文标题:Cordova方法

    本文链接:https://www.haomeiwen.com/subject/lsktdttx.html