Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 28
Registered: ‎05-27-2011
My Device: PlayBook, Torch 9800
My Carrier: none

jQuery Mobile Beta 1 page switching problem

[ Edited ]

Hi *,

 

I'm running latest firmware on PlayBook 1.0.6.2390 and if I run my app with jQuery Mobile Alpha 4 everything works fine. If I use Beta 1, suddenly switching between pages is does not work. Even the simple demo from jQuery Mobile site (http://jquerymobile.com/demos/1.0b1/docs/pages/multipage-template.html). But if I check the demo in browser it's OK. And if I run the application in browser on PC it's fine too.

 

Can anybody confirm same issue? Any workaround?

--
Jiri {x2} Cincura
blog.cincura.net
Contributor
Posts: 28
Registered: ‎05-27-2011
My Device: PlayBook, Torch 9800
My Carrier: none

Re: jQuery Mobile Beta 1 page switching problem

Just now I tested the application (mine) directly in browser on PlayBook and there works fine too.

Looks like some issue with compiled app.
--
Jiri {x2} Cincura
blog.cincura.net
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: jQuery Mobile Beta 1 page switching problem

Are you whitelisting all the domains needed to be able to have the demo run in a WebWorks app?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 28
Registered: ‎05-27-2011
My Device: PlayBook, Torch 9800
My Carrier: none

Re: jQuery Mobile Beta 1 page switching problem

Yes. I do. The application works fine with with Alpha 4, just switching files to Beta 1 and it's broken (but works in browser). :smileysad:

 

Visually the some code from jQuery Mobile is done, as I see the initial page, some animations etc. But the (at least) page switching doesn't work - always goes to first page (but adds new element to the end of document). Maybe it's some minor issue with the compiled app enviromnent and jQuery Mobile together. 

 

BTW I'm using BlackBerry WebWorks SDK for TabletOS 2.1.0.6. 

--
Jiri {x2} Cincura
blog.cincura.net
Contributor
Posts: 28
Registered: ‎05-27-2011
My Device: PlayBook, Torch 9800
My Carrier: none

Re: jQuery Mobile Beta 1 page switching problem

The WebWorks SDK 2.0.0.4 has same problem. Don't know if it helps.

--
Jiri {x2} Cincura
blog.cincura.net
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: jQuery Mobile Beta 1 page switching problem

Can you post up the link that doesn't work inside of WebWorks.. the link in the initial post is giving a 404 not found

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 28
Registered: ‎05-27-2011
My Device: PlayBook, Torch 9800
My Carrier: none

Re: jQuery Mobile Beta 1 page switching problem

I was wrongly matched by forum SW. It should be http://jquerymobile.com/demos/1.0b1/docs/pages/multipage-template.html .
--
Jiri {x2} Cincura
blog.cincura.net
New Contributor
Posts: 3
Registered: ‎06-27-2011
My Device: Storm 9550
My Carrier: Iusacell

Re: jQuery Mobile Beta 1 page switching problem

I'm having the exact same issue. 

Contributor
Posts: 14
Registered: ‎07-09-2011
My Device: PlayBook 16GB
My Carrier: N/A

Re: jQuery Mobile Beta 1 page switching problem

Experienced the same problem trying 1.0b1 against my app which was built/submitted with 1.0pre-alpha4. Working on it now, if I figure it out I'll post to this forum.

Contributor
Posts: 14
Registered: ‎07-09-2011
My Device: PlayBook 16GB
My Carrier: N/A

Re: jQuery Mobile Beta 1 page switching problem

The problem seems to be the way the PB expresses the URL of a webworks app.  In my app, location.href returns "local:/index.html".  But when jQuerymobile parses out the URL and "normalizes it" in path.makeUrlAbsolute() it generates the URL as "local:///index.html" (the "//" is always added). So when you transition from #pageA to #pageB, it acts as the page is not embedded (since it compares the two) and instead tries to fetch it using ajax.

 

The workaround I came up with is to modify the makeUrlAbsolute method so that it handles the special case of "local:" being the protocol and not add the "//" in that case.  Note that I'm working with a jqm nightly, so in beta1 this might not apply:

 

makeUrlAbsolute: function( relUrl, absUrl ) {
  if ( !path.isRelativeUrl( relUrl ) ) {
    return relUrl;
  }

  var relObj = path.parseUrl( relUrl ),
    absObj = path.parseUrl( absUrl ),
    protocol = relObj.protocol || absObj.protocol,
    separator = (protocol == "local:" ? "" : "//"),  // handle special "local:" in PB webworks
    authority = relObj.authority || absObj.authority,
    hasPath = relObj.pathname !== "",
    pathname = path.makePathAbsolute( relObj.pathname || absObj.filename, absObj.pathname ),
    search = relObj.search || ( !hasPath && absObj.search ) || "",
    hash = relObj.hash;

  return protocol + separator + authority + pathname + search + hash;
// was ... protocol + "//" + authority ...
 },

With this fix my app which was submitted with 1.0pre-alpha4 is working well.  In fact the latest jqm fixes some other issues (like dialog headers being slightly off the screen) so I'm going with it.