更改PhoneGap用户代理 [英] Change Phonegap User Agent

查看:161
本文介绍了更改PhoneGap用户代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的PhoneGap应用程序允许浏览一些外部网站,也使用Phonegap API。目前我有条件地包括Phonegap javascript基于您的平台(Android,iOS等)。然而,我不能告诉PhoneGap应用程序和移动设备上的常规浏览器的区别。有没有办法改变用户代理在我的Phonegap应用程序给我的服务器一个提示这个?

My Phonegap application is allowed to browse to some external sites that also use the Phonegap API. Currently I am conditionally including the Phonegap javascript based on what platform you are on (Android, iOS, etc). However, I can't tell the difference between Phonegap applications and the regular browser on a mobile device. Is there a way to change the user agent in my Phonegap app to give my server a hint about this?

最感兴趣的iOS解决方案。

Most interested in the iOS solution to this.

推荐答案

此回答类似问题还提及当前Cordova版本中可用的首选项:

This answer to a similar question also mentions a preference available in current Cordova versions:

<preference name="OverrideUserAgent" value="MyCordovaApp/1.2.3" />

这是 iOS

这篇关于更改PhoneGap用户代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆