Okei, I fix it! Android browser don't let you the same GET all the time, so I use a random to add a ?STRING to the GET and then we have diferent GETs ;)
thats all, clear! On 6 jul, 12:51, "[email protected]" <[email protected]> wrote: > Hi, > > I just developed an html that load and reload every time the same > external javascript, in firefox works, in android not. I'm trying to > make an appendchild and after that I make some replacechild but the > android browser don't make the second replacechild ... > > anyone know about this task? it really make my cry!!, lol > > I thinks this external sources ( the javascript ) is loaded in the > cache, cos' when I delete it I can make another appendchildren. any > idea? maybe there are a function in java-android to delete the cache > all the time? > > I replace the data in the javascript all the time, with another appi, > but here I post an example with "hello", maybe you can replace the > data on the fly yourself. > > thanks for your help. > > here I post my html and js code: > > ------index.html------- > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > <html> > <head> > <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> > <meta name="viewport" content="width=320; user-scalable=no" /> > <meta http-equiv="Content-type" content="text/html; charset=utf-8"> > > <title>VAMOS COPON</title> > <script type="text/javascript" charset="utf-8"> > > function loadjscssfile(filename, filetype){ > if (filetype=="js"){ //if filename is a external JavaScript file > var fileref=document.createElement('script') > fileref.setAttribute("type","text/javascript") > fileref.setAttribute("src", filename) > } > else if (filetype=="css"){ //if filename is an external CSS file > var fileref=document.createElement("link") > fileref.setAttribute("rel", "stylesheet") > fileref.setAttribute("type", "text/css") > fileref.setAttribute("href", filename) > } > if (typeof fileref!="undefined") > document.getElementsByTagName("head")[0].appendChild(fileref) > > } > > function createjscssfile(filename, filetype){ > if (filetype=="js"){ //if filename is a external JavaScript file > var fileref=document.createElement('script') > fileref.setAttribute("type","text/javascript") > fileref.setAttribute("src", filename) > } > else if (filetype=="css"){ //if filename is an external CSS file > var fileref=document.createElement("link") > fileref.setAttribute("rel", "stylesheet") > fileref.setAttribute("type", "text/css") > fileref.setAttribute("href", filename) > } > return fileref > > } > > function replacejscssfile(oldfilename, newfilename, filetype){ > var targetelement=(filetype=="js")? "script" : (filetype=="css")? > "link" : "none" //determine element type to create nodelist using > var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : > "none" //determine corresponding attribute to test for > var allsuspects=document.getElementsByTagName(targetelement) > for (var i=allsuspects.length; i>=0; i--){ //search backwards within > nodelist for matching elements to remove > if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null > && allsuspects[i].getAttribute(targetattr).indexOf(oldfilename)!=-1){ > var newelement=createjscssfile(newfilename, filetype) > allsuspects[i].parentNode.replaceChild(newelement, allsuspects[i]) > } > } > > } > > </script> > > </head> > <body> > <button onclick="loadjscssfile('lib.js', 'js')">load</button> > <button onclick="replacejscssfile('lib.js', 'lib.js', > 'js')">replace</button> > <button onclick="alert('var temperatura is: ' + > temperature)">temperature</button> > > </body> > </html> > > --------lib.js--------- > > var petname="hello" > alert("Pet Name: " + petname) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" 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/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

