ios远程html注入js,javascript在iOS 8的uiwebview中注入
我正在iOS 8预览版2中测试我的项目.现在我面临有关uiwebview的两个问题我使用以下代码注入脚本NSString *jsCLOSE_WINDOW = @"function CLOSE_WINDOW(){document.location ='mySchema://FUNCTION=CLOSE_WINDOW';}";[self.webView stringByEvaluatingJavaSc
我正在iOS 8预览版2中测试我的项目.
现在我面临有关uiwebview的两个问题
我使用以下代码注入脚本
NSString *jsCLOSE_WINDOW = @"function CLOSE_WINDOW(){
document.location ='mySchema://FUNCTION=CLOSE_WINDOW';
}";
[self.webView stringByEvaluatingJavaScriptFromString:jsCLOSE_WINDOW];
在“-(void)webViewDidFinishLoad:(UIWebView *)webView”中
并得到回应
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
它在iOS 7.1和更早版本中可以正常工作.
但是在iOS 8预览2中
1.document.location = 'mySchema://FUNCTION=CLOSE_WINDOW';
seems not working anymore? I can't get the response in "shouldStartLoadWithRequest"
2.in iOS 7.1 and earlier every time page redirect to another
(ex:page1.html -> page2.html -> page3.html)
"webViewDidFinishLoad" will be triggered in every page.
But, in iOS 8 preview 2 it only triggered once in first page
我该如何解决?还是iOS 8中的新限制?
有任何想法吗?欣赏.
更多推荐
所有评论(0)