[Project_owners] XMLHttpRequest - how can one bypass cache?

Andrey Gromyko andrey at gromyko.name
Fri Aug 4 11:05:54 EDT 2006


On Thu, 03 Aug 2006 21:56:36 +0100
Matthew Wilson <matthew at mjwilson.demon.co.uk> wrote:

> 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.

Yep. I can say that there is a number of such cases in practice also. The problem is that not all webmasters react on emails, I'm not saying about answering... And, honestly, I don't speak all the languages NewsFox translated in. Thus, I cannot write to all such webmasters even if I would generously dedicated my time to educate them.

I suppose it is a good point to stop the useless conversation, unrelated to the technical problem in the subject.

Have a nice weekend!

Andrey


More information about the Project_owners mailing list