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
New Developer
Posts: 22
Registered: ‎05-14-2009
My Device: Not Specified

Re: JavaScript runs once but won't continually update

My code works fine in IE and FF, but it won't work on BB. On BB, I only get the first image, not continuous images, but at least I know my server-side code is working and that the random function avoids any caching problems in the browser and MDS. So the problem must be on the client side --- there must be something different about the way BB browser handles JavaScript than IE and FF do it. What could it be ? What timer functions are available in BB JavaScript for the 8330 and 9530 ? I need sub-second timing.

 

I don't really care about the 9530, I'm just using it as an example of a recent model since an earlier comment said there is a version problem with JavScript in the 8830. For comparison, in PHP, it's clear what the functions are and what version of the OS is required for each one, but I can't find any such information for BB JavaScript. Can someone point me to such a list ?

 

 

Guru I
Posts: 19,020
Registered: ‎07-29-2008
My Device: Passport, Playbook, 9320BES
My Carrier: Bouygues _ SFR

Re: JavaScript runs once but won't continually update

okay, I tried to help you but you don't seem too receptive. I give up.

you can get information on the technical features of the BlackBerry browser for the 4.2 OS and for the 4.3 OS by clicking on the "DEVELOPERS" button on top of the current page. Good luck.



The search box on top-right of this page is your true friend, and the public Knowledge Base too:
Developer
Posts: 189
Registered: ‎08-13-2008
My Device: Not Specified

Re: JavaScript runs once but won't continually update

Hello I just set up a quick test using the 9530 and it runs ok using setInterval function.

 

You must have a problem somewhere in the javascript or PHP. If an error is raised there will be no error message unless you capture the exception, and the js will stop running.

 

Here is my test page that I ran on a 9530.

 

setInterval test

 

 

I would suggest you do as Xandrex suggested and work up from the bottom, get the most basic function working first then build it up.

 

 

Developer
Posts: 189
Registered: ‎08-13-2008
My Device: Not Specified

Re: JavaScript runs once but won't continually update

In the code you posted you are missing a " from the script line.

 

<script language="JavaScript">

 

 

I don't know if that will help, but the BB browser is very delicate! :-) and something like that will cause problems.

New Developer
Posts: 22
Registered: ‎05-14-2009
My Device: Not Specified

Re: JavaScript runs once but won't continually update

Hi Abarber,

 

Many thanks for your two posts. I've changed several details of my script, none of which seem to matter in IE and FF:

 

1) a missing "

 

2) changed ' to " in the line for setInterval

 

3) added a ; in the line for setInterval

 

but, it still won't run repeatedly on 9530.

 

How do I get exception reports from the simulator to help identify problems ?

 

How do I keep the simulator screen from going dark after a few seconds of inactivity ?

 

Does your script also run on the 8330 ?

 

I using timer functions from JavaScript 1.0, and BB supposedly supports 1, 2, 3 and 4, and parts of 5, 6, and 7, so I'm mystified about an earlier comment about what functions the 8330 supports. I can't find a summary of which functions which simulators support.

 

If there aren't any timer functions for 8330, what is the workaround to provide repeated updates (of images) ?

 

 

Cheers,

 

 

Developer
Posts: 189
Registered: ‎08-13-2008
My Device: Not Specified

Re: JavaScript runs once but won't continually update

Which version of the OS are you using? Is it v4.3?

 

navigate to - OPTIONS - ABOUT

 

to find documentation - http://na.blackberry.com/eng/support/docs/subcategories/?userType=21&category=BlackBerry+Browser

and select the version you are testing.

 

Are you able to give me a link so that I can test it on my simulator?

 

Cheers

 

Andrew

New Developer
Posts: 22
Registered: ‎05-14-2009
My Device: Not Specified

Re: JavaScript runs once but won't continually update

Hi Abarber,

 

Thank you again for your reply.

 

I'm a newbie to BB. How do I find out what OS the 8330 and 9560 are running ? Do I have any choice of it or of the version of JavaScript they run ?

 

 Here's a link to a script that works fine in IE and FF, but not on either 8330 or 9560:

 

http://24.2.212.254:8080/test-BB1000.html

 

It should update once per second (ms = 1000).

 

 

Developer
Posts: 189
Registered: ‎08-13-2008
My Device: Not Specified

Re: JavaScript runs once but won't continually update

You don't have a choice using the simulators but you can upgrade the OS on the actual BB devices.

The version of javascript is dependent on the version of the OS - browser.

The documentation explains this.

 

 

Goto - OPTIONS - ABOUT

This tells you the version.

 

 

check out this webpage out on your 8330 simulator

 

http://www.cesarcaballeroart.com/IntervalTest2.htm

 

It is an example of how setInterval works. This works on v4.3 - 8330 simulator.

 

Have a look at the code in IE to get an idea of how it works.

 

Cheers

 

Andrew

 

New Developer
Posts: 22
Registered: ‎05-14-2009
My Device: Not Specified

Re: JavaScript runs once but won't continually update

Thank you.

 

 

Here are my test results:

 

1) 8330  -- runs your test script ok. Says my script is running but does not update my images.

 

 

2) 9350 -- does not run your test script. The time does not show. It shows my first image but does not update my images. JavaScript is enabled in the browser. The BB browser is selected.

 

In both cases, I checked the MDS-Simulator DOS window and I see where it downloads only one image. 

 

 

I can't find "Goto - Options - About" on either of the two device simulators.

 

How can I get an error report from the device simulator to find out where the problem is ? Have you been able to run my test code ? Does it update ? 

 

Cheers,

 

 

Developer
Posts: 189
Registered: ‎08-13-2008
My Device: Not Specified

Re: JavaScript runs once but won't continually update

Hello

 

My test script runs fine on both the 8330 and the 9350 simulators.

 

Send me an image of the "Browser Configuration" page for the 9530.

 

Navigate to a webpage in the blackberry browser - click the "Menu" button (7 small circles, select "Options", select "Browser Configuration"

 

 

 

 

To get the version click the "Menu" button (7 small circles) - then click "Options" (spanner) - then click "About"

 

 

I couldn't test your script as the link has only worked once in IE. I get a  Network Timeout error all the time now.