UIWebView是否在请求标头中发送与移动Safari相同的用户代理? [英] Does UIWebView send the same User-Agent in the Request Headers as mobile Safari?

查看:114
本文介绍了UIWebView是否在请求标头中发送与移动Safari相同的用户代理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,我会亲自测试一下,但我现在没有我的mac。在UIWebView内部发出的Web请求是否发送了与移动Safari发出的Web请求相同的用户代理信息?

Sorry, I would just test this myself, but I'm currently without my mac. Does a web request made inside of a UIWebView send the same user-agent info that a web request made from mobile Safari would?

推荐答案

从UIWebView发出的Web请求不会在User Agent字符串中包含单词Safari。从Mobile Safari发出的Web请求会。这是我发现确定请求来自应用程序或Mobile Safari的最佳方式。

Web requests made from UIWebView will not include the word "Safari" in the User Agent string. Web requests made from Mobile Safari will. This is the best way I have found for determining of a request is coming from within an app or from Mobile Safari.

AppWeb中的UIWebView示例用户代理:

Sample User Agent from UIWebView within App:

User-Agent: Mozilla/5.0 (iPad; U; CPU OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile

来自Mobile Safari的示例用户代理:

Sample User Agent from Mobile Safari:

User-Agent: Mozilla/5.0 (iPad; U; CPU OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari

这篇关于UIWebView是否在请求标头中发送与移动Safari相同的用户代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆