views:

1013

answers:

4

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

Phonegap

[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 BTW - I ran this earlier today and got a couple more green square than just now.

Acid via browser embedded into phonegap

A: 

Maybe one browser has capabilities that another one does not?

SeanJA
Right - but,.. shouldn't it be literally the same browser? By analogy, browsing to google via mobile safari on the iphone should produce the same page as an embedded UIWebView that also points to that same google page.
JJ Rohrer
+2  A: 

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.

Al Crowley
Although the user agent is apparently part of the problem, that doesn't explain the difference in acid results and, on my own code, which doesn't use browser detection, that the results are still quite different.
JJ Rohrer
+1  A: 

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.

Pat
+4  A: 

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);
Anthony Rizk
This looks promising - i'll look into it soon.
JJ Rohrer
Ok - so I didn't get to it very quickly, but this is basically right. The latest phonegap implements this technique, but their syntax is slightly different.
JJ Rohrer