Re: [xmljs-users] Load xml from local site
Brought to you by:
djoham,
witchhunter
From: David J. <dj...@ya...> - 2004-09-01 15:46:15
|
Hmmm... Good question. Is this a problem you're seeing in development, or somehow related to a production issue? I just tried the following and it seemed to work in Konq and Mozilla. I added the following META tags to the top of the xml/html data file <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="-1"> It didn't seem to affect the data being returned to the IO function and it also seemed to allow the file to avoid being cached. Please give that a shot and let me know if it works for you... Best regards, David --- Søren Pedersen <sys...@fa...> wrote: > Hello > > I've just started playing with xmljs and it seems great. However, I've > got a problem. I would like to load a xml-file from a local site every x > second. It works ok. However, if I change the xml-file the browser keeps > getting the old file. It is as if the xml file is kept in a cache or > something. The new file is not loadet until I open mywebpage in a new > browser session. > > Is there a way to force the browser not to keep the xml file in cache? > > Heres my code: > > <script> > <!-- > setInterval("loadLocalXML()",3000) > > function loadLocalXML() { > xmlIOLoadLocalData("xmlData.xml.html", "callbackFunction"); > } > > function callbackFunction(strXML) { > //instantiate a new XMLDoc object. Send any errors to the xmlError function > var objDom = new XMLDoc(strXML, xmlError) > //get the root node > var objDomTree = objDom.docNode; > //get all of the elements named "TAG1" > var tag1Elements = objDomTree.getElements("msg"); > //get the first "TAG1" element > var element = tag1Elements[0]; > //now get the text > var text = element.getText(); > MM_changeProp('chatmsgs','','innerHTML',text,'DIV'); > } > > function xmlError(e) { > alert(e); > } > > function MM_findObj(n, d) { //v4.01 > var p,i,x; if(!d) d=document; > if((p=n.indexOf("?"))>0&&parent.frames.length) { > d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} > if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) > x=d.forms[i][n]; > for(i=0;!x&&d.layers&&i<d.layers.length;i++) > x=MM_findObj(n,d.layers[i].document); > if(!x && d.getElementById) x=d.getElementById(n); return x; > } > > function MM_changeProp(objName,x,theProp,theValue) { //v6.0 > var obj = MM_findObj(objName); > if (obj && (theProp.indexOf("style.")==-1 || obj.style)){ > if (theValue == true || theValue == false) > eval("obj."+theProp+"="+theValue); > else eval("obj."+theProp+"='"+theValue+"'"); > } > } > //--> > </script> > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > xmljs-users mailing list > xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmljs-users > |