You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Jacob Weber (JIRA)" <ji...@apache.org> on 2014/01/03 20:11:50 UTC

[jira] [Commented] (CB-5420) userAgent incorrect in iOS simulator

    [ https://issues.apache.org/jira/browse/CB-5420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13861797#comment-13861797 ] 

Jacob Weber commented on CB-5420:
---------------------------------

OK, here's what seems to be happening. If I first run a Cordova app on the iPad simulator, it caches the user agent in the app's preferences. This happens in CDVUserAgentUtil.m, in the originalUserAgent method.

Then if I run it again using the iPhone simulator, it uses the cached (iPad) value. If I delete the app and then run it, it deletes the preferences file, and then it works.

So I can work around it. But it would be better if Cordova didn't cache the user agent when it's running in the simulator, since it can change.

> userAgent incorrect in iOS simulator
> ------------------------------------
>
>                 Key: CB-5420
>                 URL: https://issues.apache.org/jira/browse/CB-5420
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 2.9.0
>         Environment: iOS 6.1 simulator from xCode 4.6.3, running as an iPhone 
>            Reporter: Jacob Weber
>            Priority: Minor
>
> If I launch a Cordova/PhoneGap app on the iOS 6.1 simulator, running in iPhone mode, and inspect it with Safari on the Mac, the value of navigator.userAgent is:
> {{"Mozilla/5.0 (iPad; CPU OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B141 (187887888)"}}
> Note that it says "iPad", although it should be "iPhone".
> If I launch Safari in the same simulator, the userAgent string is:
> {{"Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B141 Safari/8536.25"}}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)