Does UIWebView send the same User-Agent in the Request Headers as mobile Safari?(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 相同的用户代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UIWebView 是否在请求标头中发送与移动 Safari 相同的用户代理?
基础教程推荐
- SwiftUI-ScrollViewReader的ScrollTo不滚动 2022-01-01
- navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 2022-01-01
- 如何比较两个 NSDate:哪个是最近的? 2022-01-01
- Android Volley - 如何动画图像加载? 2022-01-01
- 为什么姜饼模拟器方向卡在应用程序中? 2022-01-01
- 如何将图像从一项活动发送到另一项活动? 2022-01-01
- UIImage 在开始时不适合 UIScrollView 2022-01-01
- iOS - UINavigationController 添加多个正确的项目? 2022-01-01
- Xcode UIView.init(frame:) 只能在主线程中使用 2022-01-01
- Play 商店的设备兼容性问题 2022-01-01
