美文网首页
ios开发 设置webview的userAgent

ios开发 设置webview的userAgent

作者: 忆昔日流年好 | 来源:发表于2017-05-05 17:53 被阅读0次

UIWebView *webView=[[UIWebView alloc] init];

//修改useragent

   NSString *useragent = [webView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];

   NSString *uaa = [useragent stringByAppendingString:@"iosclient"];//自定义需要拼接的字符串

   NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:uaa, @"UserAgent",@"ww", nil];

   [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];

self.title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];

ios开发 设置webview的userAgent

相关文章

网友评论

      本文标题:ios开发 设置webview的userAgent

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