[thelist] Avoiding Downstream Caching from AJAX Request

Volkan Özçelik volkan.ozcelik at gmail.com
Mon Feb 18 10:56:40 CST 2008


Hi Chris,

>
>Am I correct in saying that including the following HTTP request header
>will ensure that downstream caching is *not* performed for this
>resource?
>

Well I'm not sure about IE.

When your web page uses JavaScript to update the content of a markup
element,
Internet Explorer looks at the web address of that remote procedure call
very closely.
If the address exactly matches an address that has been previously "RPCed",
it will return the cached copy of that request from the browser
(rather than downloading a fresh copy from the web server).

As a developer of an AJAX library (sardalya) I've examined several libraries
(YUI, prototype, DOJO, ext.js and the like)
before  (and I still compare and contrast them regularly)

All of these libraries overcome caching issue by appending  a  parameter of
some sort to the  request URI.

In sardalya it is done by parsing each AJAX request.

Here is the a related snippet from sardalya:

_generateURL=function(strURL){
    var len=this._fields.length,i=0,append="";
    if(len>0){
        for(i=0;i<len;i++){
            append+="&"+this._fields[i]+"="+this._values[i];}}

    if(append===""){append="&";}

    return {url:(strURL+"?rnd="+Math.random()),query:append.substring(1)};
}

Hope that helps,
-- 
Volkan Ozcelik
+> linkibol.com - in seek for quality links : http://www.linkibol.com/
+> Going solo in Turkish: http://www.fikribol.com/donkisot/
+> My projects/studies/trials/errors : http://www.sarmal.com/
+> Sardalya JavaScript Library: http://www.sarmal.com/sardalya/



More information about the thelist mailing list