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

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

问题描述

允许我的 Phonegap 应用程序浏览一些也使用 Phonegap API 的外部站点.目前,我有条件地包含基于您使用的平台(Android、iOS 等)的 Phonegap javascript.但是,我无法分辨 Phonegap 应用程序和移动设备上的常规浏览器之间的区别.有没有办法在我的 Phonegap 应用程序中更改用户代理,以便向我的服务器提供有关此方面的提示?

最感兴趣的是 iOS 解决方案.

解决方案

这个对类似问题的回答也提到了当前 Cordova 版本中可用的首选项:

已记录在 Android 上iOS.

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?

Most interested in the iOS solution to this.

解决方案

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

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

It is documented for Android and iOS.

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

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