Resthub-js : Refresh the cache

47 views
Skip to first unread message

Filirom1

unread,
May 20, 2011, 10:14:21 AM5/20/11
to resthub-dev
Hi guys

I am discovering Single Page Web App developpement with resthub, but I
am struggling with my browser (chrome).

It doesn't want to resfresh the cache, even when I press F5.

It happens when the Controller is triggered by a click (and not by a
route).

Do you have any idea ?

Cheers

Romain

Seb

unread,
May 23, 2011, 7:55:50 AM5/23/11
to resth...@googlegroups.com
Hi,

I don't know if this is related to your problem, but during developement we usually disable browser cache (whith firefox it is done on the network tab for Firebug).

Could you send us more detail about the error that occur ?
You don't see changes made on JS files ? You got an erreur message ?

Regards,
Sébastien

Romain

unread,
May 23, 2011, 9:35:29 AM5/23/11
to resth...@googlegroups.com
Hi

Thank you for your answer.

I found a solution for Firefox (using about:config), but I think it's an equivalent to your solution.
browser.cache.disk.enable false
browser.cache.memory.enable false
ubrowser.cache.offline.enable false
network.http.use-cache false
I am still looking for a solution for chrome, but it's not so important.

An other option is tu set cache = false for jquery ajax for developpement.

define(['lib/jquery/jquery.tmpl'], function () {

$.fn.render = function( url, data, options, parentItem ) {
var element = this[0];
$(element).empty();
// Synchronous get to block caller until the template is rendered.
$.ajax({
url: url,
async: false,
                        cache: false,
success: function(template) {
$.tmpl(template, data, options, parentItem).appendTo(element);
}
});
};
});


No errors occurs, It just that I can not refresh my browser when I change some html files (no problem with js).

But it's a normal behaviour because the cache is false for script and jsonp, so it means that cache is true for html.

cacheBoolean
Default: true, false for dataType 'script' and 'jsonp'

If set to false, it will force requested pages not to be cached by the browser.


For now I stay with my customed Firefox. 
If I struggle with the other browsers (chrome, and IE for multi browser test), I will try with the cache params.


Thank you

Romain


2011/5/23 Seb <bou...@gmail.com>

Damien Feugas

unread,
May 23, 2011, 9:43:34 AM5/23/11
to resth...@googlegroups.com
Hi.

Under Chrome, you need to use CTRL+F5 to refresh.
And it still uses some cache.
Personnaly, I goes to Settings > Options > Advanced > Clear navigation data (check "clear cache").

I have the same boring procedure with IE.

With Firefox, I use WebDevelopper plugin to disable the cache (it provides a button). I guess it does quite the same you've done in the browser settings.

Happy coding !
Reply all
Reply to author
Forward
0 new messages