[Project_owners] XMLHttpRequest - how can one bypass cache?

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

Andrey Gromyko wrote:
> On Thu, 03 Aug 2006 21:17:24 +0100
> Matthew Wilson <matthew at mjwilson.demon.co.uk> wrote:
>> 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.
> There is at least one news-feed I know which has 100+ new entries a day and
 > Firefox (which, I assume, "respects the cache") doesn't fetch an 
updated xml
 > without unless I press Shift+Reload. What would you say about that? 
(rhetorical question...)

Answering non-rhetorically, I would say that, in theory, the webmaster 
has not set up his or her site correctly, and that they should fix that.


More information about the Project_owners mailing list