Hello, To prevent caching just add something random to your url. In your case:
var URL = "http://3.187.170.67/space/php_test/test.txt?random=" + Math.random(); This shouldn't affect your text file in any way. Catalin. On Fri, Mar 27, 2009 at 12:00 PM, Bandi <[email protected]> wrote: > > Dear GD-developers, > > I am new in developing gadgets, but I encountered a strange problem, > that i can not solve. > I wrote a gadget that downloads a text file form the web and displayes > it (I know it is not a difficult task, and i managed to create this > gadget). > My problem is the following: > the gadget works fine on my computer, whenever the text file on the > web is refreshed, the gadget displayes the new informations. I tried > to run the gadget on an other computer (it has the same Os and the > same version of google-desktop), and on this computer the gadget loads > the information for the first time (and the refreshing function runs), > but after this it caches the info somehow, or stores somewhere (i have > no idea, how it works), and does not reload it form the web. It is > alway using the the information downloaded at the start. > I tried to look for a solution on the web, but i could not find any > help. > Please help me, what should i do, waht should i check on the other > computer to make my gadget work. > > Thank you for your help! > > Yours sincerery, > András Horváth > > > PS.: > I wrote down the important part of the code here (however i do not > suppose, that this should be the problem,but i hope it helps): > > var URL = "http://3.187.170.67/space/php_test/test.txt"; > > var Request = null; > > var RELOAD_TIME = 6000; > > > > function onOpen() { > view.setInterval("LoadData()", RELOAD_TIME); > > } > > function LoadData() { > Request = new XMLHttpRequest(); > try { > Request.open("GET",URL, true); > } catch (e) { > statusLabel.innerText = "FAILED"; > Request = null; > return; > } > > > Request.onreadystatechange = onLogData; > > try { > Request.send(); > } catch (e) { > statusLabel.innerText = "FAILED"; > Request = null; > return; > } > } > > function onLogData() { > if (Request.readyState != 4) > return; > > if (Request.status != 200) { > statusLabel.innerText = "FAILED"; > Request = null; > return; > } > > > > //parsing the data > txtArray =Request.responseText.split("\n"); > //I deleted this part 'cause it is not really interesting, and the > code would be too long > //I just parse the Strings in txtArray to outtext > //putting the data on the frame > TXTCOntrol.innerText = outtext ; > TXTCOntrol.visible = true; > statusLabel.visible = false; > > // Destroy the XMLHttpRequest > Request = null; > } > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Desktop Developer Group" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Desktop-Developer?hl=en -~----------~----~----~----~------~----~------~--~---
