黑莓 System.getProperty(“browser.useragent”)
我们可以通过调用从设备获取用户代理
System.getProperty("浏览器.useragent")
此方法适用于 OS 4.7 +
我只在一些 Blackberry 模拟器上测试过:9530 (os 4.7)、9800 (os 6.0.0)
它起到了魅力的作用。
但据我所知,在真实设备上,如果用户更改黑莓浏览器,向服务器发出的http请求中的用户代理将会更改。例如,一些黑莓设备使用 Firefox 浏览器。
因此我想知道,如果在真实设备上更改浏览器设置,当我们调用 System.getProperty("browser.useragent") 时,返回值会改变吗???
有人在真机上测试过吗? 或者有人知道答案吗?
We are able to get the user agent from device via calling
System.getProperty("browser.useragent")
This method is available for OS 4.7 +
I only tested it on some of the Blackberry simulators: 9530 (os 4.7), 9800 (os 6.0.0)
It works as a charm.
But as far as I know that on real devices, if user changes the blackberry browser, the user agent in the http request to server will be changed. For instance, some of the blackberry devices use Firefox browser.
Therefore I would like to know, if browser setting is changed on the real device, when we call System.getProperty("browser.useragent"), will the return value change???
Has anyone tested on the real device?
or does anyone know the anwser.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在您选择的模拟器中对此进行测试,方法是创建一个应用程序来记录或打印以屏幕显示 System.getProperty("browser.useragent") 的值,然后在模拟器中进行您注意到的更改。
You could test this out in a Simulator of your choice by creating an App that logs or prints to screen the value of System.getProperty("browser.useragent") then making your noted change in the simulator.
这是一个示例:
您可以使用此方法构造 UserAgent
this is an example:
you can construct the UserAgent with this method