Currently, with iOS 17.4 EU – iOS users can switch default browser and choose another one
My app needs to get the user agent and for that, I’m getting it with:
private let webView: WKWebView = WKWebView(frame: .zero)
.....
func XXXXX(){
self.webView.evaluateJavaScript("navigator.userAgent") { (result, error) in
......
}
I tested with safari browser and get Mozilla/5.0 (iPhone; CPU iPhone OS 17_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
, after switching to Chrome as default browser, the user agent remains the same.
Anyone know if it’s possible to have an updated user-agent, based on default browser
I tried to read apple official documentation related to this and still, I’m not able to get the user-agent
Matias Pereira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.