What is the User Agent string for Apple TVs running the new Apple tvOS operating system (which I believe is based on iOS)? Do they report themselves as being "iOS" devices?
The Apple TV does not support the WebKit framework, meaning you can't technically show webpages and therefore have a User Agent.
However, if you somehow had it running one the new TVOS, the User Agent would definitely be :
Mozilla/5.0 (Apple TV; CPU iPhone OS 9_0 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13T534YI
I didn't see any official documentation on this, but a number of people have reported the user agent for tvOS being something a long the lines of:
[AppName]/1 CFNetwork/758.1.6 Darwin/15.0.0
[AppName]/1 CFNetwork/758.1.2 Darwin/15.0.0
I have seen something similar. Here is mine:
[AppName]/1 CFNetwork/758.2.8 Darwin/15.2.0
Note: These User Agents can change.
You can check for yourself using a HTTP proxy and monitor, such as Charles. Also mentioned here on SO.
Sources:
tvOS does not currently (as of October, 2017) expose any web view components (such as UIWebView
) in its SDK. However, you can still force tvOS to load UIWebView
using reflection (see answer here), and then extract user agent string from it.
let webViewClass: AnyObject.Type = NSClassFromString("UIWebView")!
let webViewObject: NSObject.Type = webViewClass as! NSObject.Type
let webView: AnyObject = webViewObject.init()
let userAgent = webView.stringByEvaluatingJavaScript(from: "navigator.userAgent")
print(userAgent!)
Output:
Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Mobile/15J380
© 2022 - 2024 — McMap. All rights reserved.