![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: XMLHTTPRequest caching problem >Thread Next - Re: XMLHTTPRequest caching problem Re: XMLHTTPRequest caching problemTo: NULL Date: 7/2/2005 9:30:00 AM Yes, set the headers correctly on your server for the directory.
In PHP you'd use this (then send the XML file contents) :
header( "Expires: Sat, 1 Jan 2005 01:00:00 GMT" );
header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
There's more information about controlling this in IE (client-side)
here :
http://jpspan.sourceforge.net/wiki/doku.php?id=javascript:xmlhttprequest:behaviour:httpheaders#conditional_get
HTH
Cheers - Neil
On Fri, 01 Jul 2005 15:01:58 +0300, Adrian Herscu
<bmf1972@a...> wrote:
>Any suggestion about how to work around this XMLHTTPRequest caching problem?
>
>Adrian.
>
>BTW Mozilla does the opposite - it always brings the XML files without
>caching (although this has been fixed in developer builds).
>
>Adrian Herscu wrote:
>
>> Hi Neil,
>>
>> Thanks for your fast reply.
>>
>> I know, there should be a better terminology.
>>
>> By "static" I meant to a file that is not generated using a
>> CGI/ASP/JSP/PHP/ISAPI/...
>>
>> But all "static" files are updated once in a time. Few examples: CSS
>> files are updated in order to bring a new look to the (dynamically
>> generated) Web pages, JS files are updated in order to bring new
>> behavior to the Web pages, HTML & PDF files are updated because the
>> documentation changed, etc., etc., etc.
>>
>> Then, why XML files are supposed to remain unchanged for the rest of
>> their life?
>>
>> By appending such a "random GET string to the URL" it will defeat the
>> caching mechanism, and files will always be retrieved. I need to load
>> those files only if they are newer than the cached ones. There is a
>> special HTTP header that does exactly that: "if-modified-since".
>>
>> MS-IE uses this header to bring all ("static") files which are
>> _hyperlinked_ from the main HTML file (i.e., scripts, stylesheets, XML,
>> XSLT, images, etc.) - because some mysterious reason, MS-XML decides not
>> to revalidate it cache.
>>
>> Any workaround?
>>
>> Thanks
>> Adrian.
>>
>> Neil Smith [MVP Digital Media] wrote:
>>
>>> (Q : If it's static, why does it matter if it retrieves from the
>>> cache, surely a static file *hasn't* changed, that's what the cache is
>>> for !)
>>>
>>> A : As for all cached files you want to regenerate (e.g. a logging
>>> image) append a random GET string to the URL, so for example
>>>
>>> <script language="javascript1.2">
>>> var randomItem=new Date();
>>> documentHref=documentHref+'?random='+randomItem.getUTCMilliseconds();
>>> // Etc etc
>>> </script>
>>>
>>> On Thu, 23 Jun 2005 00:08:23 +0300, Adrian Herscu
>>> <bmf1972@a...> wrote:
>>>
>>>
>>>> Hi all,
>>>>
>>>> I am using MSXML 3.0 to synchronously load XML documents in the browser.
>>>>
>>>> Here is a snippet:
>>>>
>>>> xmlHttpRequest = new ActiveXObject( "MSXML2.XMLHTTP.3.0" );
>>>> xmlHttpRequest.open( "GET", documentHref, false );
>>>> xmlHttpRequest.send( null );
>>>>
>>>> documentHref always points to a _static_ XML file.
>>>>
>>>> This generates no HTTP request - the browser retrieves the file from
>>>> its cache.
>>>>
>>>> Is it possible to make it send a conditional GET?
>>>>
>>>> Thanks for your time,
>>>> Adrian.
>>>
>>>
>>>
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
