为什么 google.com 在黑莓手机和黑莓手机上看起来不同 Phonegap 与黑莓手机 浏览器

发布于 2024-07-18 08:47:05 字数 1418 浏览 11 评论 0原文

我正在努力让phonegap在黑莓风暴(9530模拟器)上运行。 我一直在使用 BB 的内置浏览器测试我的 web 应用程序,它看起来不错,但是当我尝试查看phonegap 中的一些代码时,它完全被咬住了,即使我将phonegap 指向相同的URL(我没有尚未达到在设备上本地运行代码的程度)。

我在谷歌上尝试了一个测试用例并得到了类似的结果。 见下文。 我怀疑我在这里遗漏了一些基本的东西。 我本以为两张图片几乎是一样的。

浏览器 http://www.eleganttechnologies.com/outside/ImgDeviceBB9530WebGoogle.jpg

http://www.eleganttechnologies.com/outside/ImgDeviceBB9530PgGoogle.jpg

[更新] 为了阐明正在发生的情况,我针对 W3 移动网络酸测试运行了浏览器和嵌入式浏览器 (phonegap): http://www.w3.org/2008/06/mobile-test/ 我确实注意到两者之间的差异,但我还不知道“为什么”和“如何解决”。

Acid 通过内置浏览器
(来源:eleganttechnologies.com
顺便说一句 - 我今天早些时候运行了这个,得到了比刚才更多的绿色方块。

Acid 通过浏览器嵌入到 PhoneGap 中 http://www.eleganttechnologies.com/outside/ImgDeviceBb9530PgAcid.jpg

I'm tyring to get phonegap up and running on blackberry storm (9530 simulator). I had been testing my webapp from withing BB's built in browser, and it was looking ok, but then it totally bit once I tried to look at the some code from within phonegap, even though I was pointing phonegap to the same url (I hadn't yet gotten to the point of running code locally on the device).

I tried a test case on google and got similiar results. see below. I suspect that I'm missing something basic here. I would have expect both images to be nearly identical.

Browser
http://www.eleganttechnologies.com/outside/ImgDeviceBB9530WebGoogle.jpg

Phonegap
http://www.eleganttechnologies.com/outside/ImgDeviceBB9530PgGoogle.jpg

[Update]
To shed some light on what is happening, I ran the browser and the embedded browser (phonegap) against the W3 mobile web acid test: http://www.w3.org/2008/06/mobile-test/
I definitely notice differences between the two, but I don't yet know the 'why' and the 'how-to-address'.

Acid via built-in browser

(source: eleganttechnologies.com)
BTW - I ran this earlier today and got a couple more green square than just now.

Acid via browser embedded into phonegap
http://www.eleganttechnologies.com/outside/ImgDeviceBb9530PgAcid.jpg

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

渡你暖光 2024-07-25 08:47:05

免责声明:我对音隙一无所知,但有一个很好的理论。 默认情况下,BlackBerry 上的嵌入式浏览器控件使用比 BlackBerry 浏览器本身旧版本的渲染引擎。

在去年的黑莓开发者大会上,对此进行了一次讨论,并且有一个未记录的选项可以使用更新的渲染引擎。 \

选项 ID 是 17000(是的,一个神奇的数字,它可能会改变,使用时需要您自担风险等),并且应该设置为 true。 不确定如何通过phonegap传递此选项(我不熟悉该工具包),但使用BlackBerry API,它是这样的:

BrowserContent content;
...
content.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, 17000, true);

Disclaimer: I don't know anything about phonegap, but have a pretty good theory. By default the embedded browser control on BlackBerry uses an older version of the rendering engine than the BlackBerry browser itself does.

At the BlackBerry developer conference last year, a talk was given about this, and there's an undocumented option to use the newer rendering engine. \

The option ID is 17000 (yes, a magic number, which could change, use at your own risk etc), and should be set to true. Not sure how you'd pass this option through phonegap (I'm not familiar with the toolkit) but using the BlackBerry APIs it's something like:

BrowserContent content;
...
content.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, 17000, true);
机场等船 2024-07-25 08:47:05

我不知道您使用的浏览器的具体情况,但我确实知道大多数大型网站都会检测您的操作系统+浏览器组合,以决定向您显示哪些 HTML。

如果 Google 看到不同的用户代理,您可能会获得 HTML 的通用移动版本,而不是为内置浏览器获得的 Blackberry 特定 HTML。

如果您有权访问网络服务器,请尝试使用两种浏览器设置来访问它,并查看日志文件中是否有任何差异。 这可能会告诉你一些有趣的事情。

I don't know the specifics of the browsers you are using, but I do know that most of the big sites will detect your OS + browser combination to decide what HTML to show you.

If Google is seeing a different user agent, you might get a generic mobile version of the HTML instead os the Blackberry specific HTML you get for the built in browser.

If you have access to a web server, try hitting it with both browser setups and see if there is any difference in the log file. That might tell you something interesting.

留蓝 2024-07-25 08:47:05

正如我们在 Acid 测试中看到的...

一个浏览器(内置浏览器)正确报告为 BlackBerry9530,而另一个(phonegap)未显示用户代理 [“使用 . 进行测试”]。
在这种情况下,Google 为您提供其主页的默认视图,而当您将自己报告为 BlackBerry 设备时,您将获得 BlackBerry 特定的呈现。

听起来,使用phonegap 正在删除默认的用户代理(很可能是因为它无法识别您的设备)。 由于phonegap是开源的,最好的选择是进入那里,调试它并找出当http请求离开设备时用户代理会发生什么,并从那里跟踪它。

As we can see in your Acid tests...

One browser (the built-in one) is reporting correctly as a BlackBerry9530, and the other (phonegap) is not presenting the user-agent ["Testing with ."].
In this case, Google is providing you with the default view of their homepage, whereas when you are reporting yourself as a BlackBerry device, you will get the BlackBerry specific rendering.

By the sounds of things, using phonegap is removing the default user-agent (most probably because it's not recognising your device). As phonegap is open-source, the best bet is to get in there, and debug it and find out what happens with the user-agent when the http requests leave the device and track it back from there.

雨后咖啡店 2024-07-25 08:47:05

也许一种浏览器具有另一种浏览器所没有的功能?

Maybe one browser has capabilities that another one does not?

兔小萌 2024-07-25 08:47:05

嗯。 通过查看屏幕截图,我会说第二页可能缺少一些资源。 它可能缺少一些图像、脚本和 CSS 文件,这可以解释不同的 l&f。 了解 Blackberry Browser Field API 的工作原理后,我猜想使用 BrowserField 的实现没有正确完成。 只是我的猜测。 除此之外,当浏览器字段初始化时,调用者需要通过启用适当的浏览器功能(脚本、样式等)来正确配置它。同样,API 是以一种非常奇怪的方式完成的,我曾经陷入过这个陷阱。 设置选项时,您不能只创建一个掩码(如 CSS | WML | SCRIPT)并进行一次调用。 选项是数字的,而且我相信,不重叠 - 但您仍然需要调用 API 来独立设置每个选项。

另外,BrowserField 资源的异步加载方式也需要时间来理解。

只是我的 0.02 美元。

Hm. By looking at the screenshot I would say that the second page is probably missing some resources. It may be missing some images, scripts and the CSS files, which would explain different l&f. Knowing how Blackberry Browser Field API works, I would guess that the implementation that uses the BrowserField was not done correctly. Just my guess. In addition to that, when the browser field is initialized the caller needs to configure it properly by enabling the appropriate browser features - scripts, styles etc. Again, the API is done in a very weird way, I have gotten myself into this trap once. When setting the options, you cannot just create one mask (like CSS | WML | SCRIPT) and make one call. Options are numeric and, I believe, non-overlapping - but you still need to call the API for setting each option independently.

Also the way asynchronous loading of the resources for BrowserField takes time to understand.

Just my $0.02.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文