Skip to content

Instantly share code, notes, and snippets.

@EddyVerbruggen
Last active December 8, 2018 05:28
Show Gist options
  • Save EddyVerbruggen/cd02c73162180793513e to your computer and use it in GitHub Desktop.
Save EddyVerbruggen/cd02c73162180793513e to your computer and use it in GitHub Desktop.
iOS8 Beta Phonegap fix: manually set the navigator.userAgent
// temp fix for iOS8 beta 1 (fixed in beta 2), add it after the reference to cordova.js
if (navigator.userAgent === undefined) {
navigator.__defineGetter__('userAgent', function() {
return("Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit");
});
}
@sixman9
Copy link

sixman9 commented Dec 16, 2014

Hi, newbie question here but would this trick also affect the way Phonegap/Cordova reports its browser user agent when making external HTTP requests?

If yes, then this is a much simpler way than these suggestions:

change-phonegap-user-agent (@Stackoverflow, for IOS)

&

change-phonegap-cordova-user-agent-for-ajax (@Stackoverflow, for Android)

Of course, I do realise I could just test it out ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment