I know we can initialize a UIWebView
or WKWebView
then inject JavaScript to get the value of navigator.userAgent
, however that requires the initialization of UIWebView
, which takes much time . Is there a way to get UserAgent faster?
If you need the exact userAgent
string, you can ignore this answer.
If, however, you are interested in the info encoded inside the userAgent
string, you can get most/all of them with other APIs... eg you get the device type with UIDevice.current.model
; the browser type is Safari/Mobile Safari (didn't check what's the exact string but this value is unlikely to change); the platform obviously is iOS; etc.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.