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
Developer
Posts: 125
Registered: ‎10-02-2011
My Device: Playbook
My Carrier: none
Accepted Solution

Prevent Caching on Playbook App

[ Edited ]

How do I stop my app from caching remote scripts, json feeds etc? For development I've setup my app to load in scripts remotely so I can do quick testing. But the caching is a problem.

 

Update - I found out how to do this by adding random numbers to the end of the file name. For example:

<script type="application/javascript">
document.write('<script src="http://www.domain.net/scripts/main.js?ord='+Math.random()+'?"><\/script>');
</script>

 

BlackBerry Development Advisor
Posts: 635
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: Prevent Caching on Playbook App

[ Edited ]

Great!  I was about to suggest the same thing, but you beat me to it :smileywink:

 

<script type="application/javascript">
document.write('<script src="http://www.domain.net/scripts/main.js?ord='+Math.random()+'?"><\/script>');
</script>
 

 

Retired
Posts: 37
Registered: ‎01-08-2010
My Device: Various
My Carrier: Rogers

Re: Prevent Caching on Playbook App

The caching in WebWorks on PlayBook is exactly like the browser. Either the random query string param like you've done, or setting up proper cache-control headers on your server. It really depends on how you want caching to behave once in production environment.