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

查看:17
本文介绍了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 请求不会在用户代理字符串中包含单词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.

来自 App 内 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天全站免登陆