webView小知识
1. 获取超链接的地址
document.getElementsByTagName('a')[0].href
2.禁止超链接的响应
document.getElementsByTagName('a')[0].setAttribute('onclick','return false')
3.webview的请求中加入请求头
NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
request addValue: @"userName" forHTTPHeaderField:@"x-user-name"];
[webview loadRequest:request];
4. info.plist 里面添加 View controller-based status bar appearance 设置为NO,[UIApplication sharedApplication] 优先级高于 UIViewController里preferredStatusBarStyle
设置为YES,则UIViewController里的preferredStatusBarStyle 优先级高于[UIApplication sharedApplication]
网友评论