WKWebView UserAgent changes on iPad

My sample app request user agent as <Mozilla / 5.0 (iPad; CPU OS 13_0 like Mac OS X) AppleWebKit / 605.1.15 (KHTML, like Gecko) Mobile / 15E148> on WKWebView, iPadOS 13.

Then response received via didFinishNavigation, user agent has changed to <Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko)>.



It doesn't happen if witdh of WKWebView is less than 375.



Is this a Bug or New Specification?

I too have observed that if safari or an app with a wkwebview is split paned with an another app and the first app's width is compact, the displayed website will load the mobile version of the site. Ditto for bringing up Safari or a WKWebView app in a compact width popup. Resizing the safari or app w/WKWebView to a regular width causes the desktop version to be loaded.


I think this is a feature, but am not 100% certain.


Neal

Are there any news on this (maybe with the latest version of iOS 13.3?) - not being able to set the userAgent makes it difficult to request the mobile version of a web page.

This was a new feature in iOS 13.

Watch Desktop-class Browsing on iPad

That session also tells you how to change the User Agent using the new WKWebPagePreferences API 👍
WKWebView UserAgent changes on iPad
 
 
Q