1. 调用java script
现在只能实现弹出窗口
[self.m_webView stringByEvaluatingJavaScriptFromString:@"alert(1)"];
2. 获取页面的标签
NSString *title = [self.m_webView stringByEvaluatingJavaScriptFromString:@"document.title"];
3. 页面调用函数
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { if ([request.URL.absoluteString rangeOfString:@"shareMessIOS"].location!=NSNotFound) { NSString *utf8 = [request.URL.absoluteString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSArray *array = [utf8 componentsSeparatedByString:@"<|#@VGSEPERATOR@#|>"]; NSString * ss = [array objectAtIndex:1]; NSLog(@"intro=%@",array ); return NO; } return YES; }
应该会进来两次,或者以上。第一次不会进入到if ,第二次才进来。