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: 10
Registered: ‎08-22-2008
My Device: Not Specified

Javascript file and browser cache

Hi all, I'm new in BB Web development and I have some loading performance problem.

I have an example XHTML page :

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" /> <title></title> <script src="../js/jsFile1.js"></script> <script src="../js/jsFile2.js"></script> </head> <body> <form name="FORM_1" id="FORM_1" method="post" action="essai1.html"> <input type='submit' /> <!-- submit to the same page --> </form> </body> </html>

 

In this page I include 2 Javascript files (jsFile1.js size 100 Kb and jsFile2.js size 30 Kb)

I test my page with several Blackberry device simulators : I load my page and then click to the submit button.

 

First test: With Blackberry device simulator 8100 and 7130 (OS version 4.2.1.96), 8830 (OS version 4.2.2.123), 8130 (OS version 4.3.0.97) and 8330 (OS version 4.3.0.124), when i click to the submit button, i see clearly 2 messages "Requesting script..." (appear about 1 second each). It seems that the browser request the Javascript file over HTTP but theses files are in browser cache !

 

Second test: With Blackberry device simulator for product number 7100, 7250, 7290, 7520, 8700 (OS version 4.1.0.258), when i click to the submit button, i don't see "Requesting script..." message. It seems that the browser get Javascript files from cache.

It takes half time less to re display the page than with the first test.

 

Could you explain me why there is a difference in processing this page ?

How can I improve time loading with devices used in the first test ?

 

Thanks for your replay

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

Re: Javascript file and browser cache

hello, is "essai1.html" the name of your htlm file ?
otherwise, I don't understand why clicking on the submit button should trigger any javascript.

in that case, you are talking about a page with a form that calls oneself ?



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

Re: Javascript file and browser cache

Yes, "essai1.html" is the name of my html file.

It's just a simple sample. In my real application, this page is used to page up and down a table list of customers...

 

Thanks for your interest

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

Re: Javascript file and browser cache

when designing a webpage that will work for many browsers, I strongly advise you to confront it to the W3 validator :

http://validator.w3.org/

 

I think the biggest thing is to add a type="text/javascript" to your two < script > element.




The search box on top-right of this page is your true friend, and the public Knowledge Base too:
Guru I
Posts: 19,017
Registered: ‎07-29-2008
My Device: Passport, Playbook, 9320BES
My Carrier: Bouygues _ SFR

Re: Javascript file and browser cache


ozzob1 wrote:

How can I improve time loading with devices used in the first test ?

 

Thanks for your replay





I think the first thing to do is reduce the size of your javascript files. A webpage, for a handheld navigator, should not have an overall size of more than 30k (html + js + css + img). Yours is at least 130k ! that's at least 30s of download for just one page for someone who does not have a 3G or Wi-Fi mobile phone. Then you have to add the time your browser will interpret the script. That's very slow on Blackberries because the CPU is not very powerful.



The search box on top-right of this page is your true friend, and the public Knowledge Base too: