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
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: PlayBook Webworks cannot read local files

I know that there is a fix in the works.. but from what I hear, an AJAX call accessing local:/// resources is returning the status code 0 instead of 200 for success.  That may be the issue you're seeing.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB
My Carrier: Sprint

Re: PlayBook Webworks cannot read local files

Possibly yes. It seems common JS libraries however are unable to handle this.

 

Is it going to get changed into a 200? Would probably make life easier Smiley Happy

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: PlayBook Webworks cannot read local files

Absolutely it will be changed to a 200 Smiley Happy

 

We are just trying to get it slotted into a Simulator/OS build that's available to you

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 36
Registered: ‎04-06-2010
My Device: Bold 9700
My Carrier: AT&T

Re: PlayBook Webworks cannot read local files

Maybe you can use .ajax() instead of of .getJSON() and map status 0 tto your callback?

 

This is a shorthand Ajax function, which is equivalent to:

$.ajax({

  url: url,

  dataType: 'json',

  data: data,

  success: callback

});

 

 

 

statusCode(added 1.5)Map

Default: {}

A map of numeric HTTP codes and functions to be called when the response has the corresponding code. For example, the following will alert when the response status is a 404:

$.ajax({

  statusCode: {404: function() {

    alert('page not found');

  }

});

If the request is successful, the status code functions take the same parameters as the success callback; if it results in an error, they take the same parameters as the error callback.

 

 

 

As of jQuery 1.5, $.ajax() provides three means to extend its functionalities for sending, receiving, and managing ajax requests:

 

 

Developer
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB
My Carrier: Sprint

Re: PlayBook Webworks cannot read local files

I suppose I could but the real solution here of course is a fix so it will provide a status 200 code. Also if I now cater for statuscode 0 and they change it into 200 the code would break. My script node insertion workaround would keep working. An added bonus of it by the way is the fact that the app will work on a local PC/Mac when debugging because the data gets loaded unlike when using XHR which isn't allowed to connect to your own local box Smiley Wink

 

I'll give it a go though just to see if it can be made to work like you suggest.

 

 

 

 

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

New Contributor
Posts: 6
Registered: ‎02-21-2011
My Device: Blackberry Bold 9700
My Carrier: Vodafone - ES

Re: PlayBook Webworks cannot read local files

Hi,

 

I use a own Ajax Framework, so I mapped the 0 code to my function and it worked.

 

Thanks a lot!

Contributor
Posts: 36
Registered: ‎04-06-2010
My Device: Bold 9700
My Carrier: AT&T

Re: PlayBook Webworks cannot read local files

Too bad jQuery 1.5.1 is cause problems.  Look what I found in the release notes.

 

#8125 Status is set to 200 for requests with status 0 when location.protocol if “file:”. Added test/localfile.html to control it works

Highlighted
Developer
Posts: 49
Registered: ‎02-09-2011
My Device: Not Specified

Re: PlayBook Webworks cannot read local files

I was going to say 1.5.1 fixes this issue due to a patch we pushed through, but apparently now something else is broken, the jQuery team is working on fixing this issue, hopefully we'll have a solution soon.

 

Levi De Haan // Sr. Programmer/Sys. Admin 
1-877-578-3794 x 1000
@levidehaan
1-877-JQUERY-HELP
1-303-747-6007