wkwebview 和 JS 自用

 -(void)webView:(WKWebView *)webView didCommitNavigation:(null_unspecified WKNavigation *)navigation{
//获取 当前页URL
NSString *js = @"document.location.href";
[self.webView evaluateJavaScript:js completionHandler:^(id _Nullable response, NSError * _Nullable error) {
NSLog(@"response: %@", response);
}]; } //这个调用只能放在 finish 里,不然会报JS 异常
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
NSString *js = @"headHide()";
[self.webView evaluateJavaScript:js completionHandler:^(id _Nullable response, NSError * _Nullable error) {
NSLog(@"\n error: %@", error);
}]; }
上一篇:通俗版解释网关,IP地址,ARP欺骗,DDOS攻击


下一篇:openstack内外网ip实现