[Project_owners] XMLHttpRequest - how can one bypass cache?

Matthew Wilson matthew at mjwilson.demon.co.uk
Thu Aug 3 22:17:24 EDT 2006

Andrey Gromyko wrote:
> Hi All,
> In the NewsFox extension I use next lines to download feed(s):
>     var xmlhttp = new XMLHttpRequest();
>     xmlhttp.open("get", feed.url);
>     xmlhttp.setRequestHeader("User-Agent", "Mozilla/5.0 NewsFox/0.3.4");
>     xmlhttp.overrideMimeType("application/xml");
>     xmlhttp.onload = function() { checkFeed(index, xmlhttp.responseXML); }
>     xmlhttp.send(null);
> Adding the next line before send doesn't help to avoid the use of Firefox's cache:
>     xmlhttp.channel.loadFlags = Components.interfaces.nsICachingChannel.LOAD_BYPASS_CACHE;
> And that causes problems with some feeds. Does anybody know how can I bypass the cache? Similarly tp the behaviour of the browser when somebody pressed Shift+Reload.

Arguably you should be respecting the cache here. If a feed is set up so 
that newsreaders only refetch it every hour (for example), then that's a 
deliberate strategy to reduce bandwidth, and a well-behaved client 
follow the rules.


More information about the Project_owners mailing list