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

Java Development

Reply
Regular Contributor
Posts: 74
Registered: ‎01-12-2012
My Device: Developer
My Carrier: Developer

Java + Web (enabled local java script loading)??

Hello, I was wondering If I could have my application be a Java App that contains a BrowserField.
but what I want from this is to have the Javascript Files locally in my app...

So for example I would call "www.mysite.com?localjavaScript=true" from my BrowserField.
And I would have mysite checking for  "localjavaScript=true", if this is found then I make importing java script
to local instead of having to download them.

example JavaScript suedocode :

if(localjavaScript=true){
<script src="Bb_Local_Directory/functions.js" type="text/javascript"></script>

 }

else{

<script src="www.mysite.com/libs/js/functions.js" type="text/javascript"></script>

}

----------------------------------------------------
I thought of this since the IFRAME in webworks was making problems (different unpredictable outcomes on devices..e.g: no scrolling etc)
And the other thing which was just making all mysite local in webworks WAS heavy (loading takes long time/ on first load and on page change) 

Thank you alll, And I just wanted to know if this Idea was viable !
All Help's appreciated.. 

Highlighted
Developer
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: Java + Web (enabled local java script loading)??

I'm not sure I completely understand your problem but I think you might be looking for a cache for your browserField.

 

This way, the first time you would request the js file it will come from the server and afterwards you would load it from local storage.

 

Also, you won't need to check/change the URL.

 

Check out this KB:

http://supportforums.blackberry.com/t5/Java-Development/How-to-Implement-a-Web-Cache-for-Your-Browse...

 

E.