XMLHttpRequest() not working anymore
I have to display some data from XML file inside a HTML page Both files (XML and HTML) are on a local disk of the same computer under Windows 10. What I'm describing a process that has been working for over 10 years.
Suddenly after a Firefox update (version 70) the data coming from the XML file was not displayed anymore. Lookung around I have discovered to set privacy.file_unique_origin to false and all was working again.
Now, after the Firefox version 71 update the page is still not working under Windows 10. (even with privacy.file_unique_origin set to false) I have tried on MacOS (FF ver. 71( and it is working correctly.
Because I have written the page 10 years ago and I am now no more active in the field I would like to ask if somebody can give me some help. Here the part of code related to the decode of XLM
Part of HTML
<table border="0" width="100%"> <tr> <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b> Dati alle ore </b></td> <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b> Temperatura </b></td> <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b> Umidità </b></td> <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b> Vento km/h </b></td> <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b> Pressione </b></td> <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b> Pioggia odierna </b></td> </tr> <tr style="height: 50; "> <td bgcolor="#FFFFFF"><center><font face="Verdana" size=6><span id="time"></span></td> <td bgcolor="#FFFFFF"><center><font face="Verdana" size=6><span id="temp"></span> °C</td> <td bgcolor="#FFFFFF"><center><font face="Verdana" size=6><span id="hum"></span> %</td> <td bgcolor="#FFFFFF"><center><font face="Verdana" size=6><span id="windspeed"></span> <span id="winddircart"></span></td> <td bgcolor="#FFFFFF"><center><font face="Verdana" size=6><span id="baro"></span> hPa</td> <td bgcolor="#FFFFFF"><center><font face="Verdana" size=6><span id="dayrain"></span> mm</td> </tr> </table> <script> var xmlhttp, xmlDoc; xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", "./marzio/Web/wlfulldata.xml", false); xmlhttp.send(); xmlDoc = xmlhttp.responseXML; document.getElementById("time").innerHTML= xmlDoc.getElementsByTagName("TIME")[0].childNodes[0].nodeValue; document.getElementById("temp").innerHTML= xmlDoc.getElementsByTagName("TEMP")[0].childNodes[0].nodeValue; document.getElementById("hum").innerHTML= xmlDoc.getElementsByTagName("HUM")[0].childNodes[0].nodeValue; document.getElementById("windspeed").innerHTML= xmlDoc.getElementsByTagName("WINDSPEED")[0].childNodes[0].nodeValue; document.getElementById("winddircart").innerHTML= xmlDoc.getElementsByTagName("WINDDIRCARD")[0].childNodes[0].nodeValue; document.getElementById("baro").innerHTML= xmlDoc.getElementsByTagName("BARO")[0].childNodes[0].nodeValue; document.getElementById("dayrain").innerHTML= xmlDoc.getElementsByTagName("DAYRAIN")[0].childNodes[0].nodeValue; </script> </body> </html>
Part of XML file
<?xml version="1.0"?> <!--File Name: wlfulldata.xml--> <WXDATA> <PARAM> <DATE>14/01/17</DATE> <TIME>17:45</TIME> <STADATE>14/01/17</STADATE> <STATIME>17:44</STATIME> <UTCDATE>14/01/17</UTCDATE> <UTCTIME>16:45</UTCTIME> <STANAME>marzio</STANAME> <CITY> </CITY> <STATE> </STATE> <ELEV> 725 m</ELEV> <SUNRISE> 8:03</SUNRISE> <SUNSET>17:07</SUNSET> <TEMP>1.5</TEMP> <TEMPHI>5.8</TEMPHI> <TEMPHIT>13:42</TEMPHIT> <TEMPLO>-2.6</TEMPLO> <TEMPLOT> 5:34</TEMPLOT> <TEMPHIMO>12.1</TEMPHIMO> <TEMPLOMO>-6.0</TEMPLOMO> <TEMPHIYR>12.1</TEMPHIYR> <TEMPLOYR>-6.0</TEMPLOYR> <HUM>52</HUM> <HUMUNIT>% </HUMUNIT> <HUMHI>81</HUMHI> <HUMHIT> 7:26</HUMHIT> <HUMLO>36</HUMLO> …… …...
Bewerkt door cor-el op
Gekozen oplossing
Could you check for messages in Firefox's Web Console. You can open the Web Console in the lower part of the tab using either:
- "3-bar" menu button > Web Developer > Web Console
- (menu bar) Tools > Web Developer > Web Console
- (Windows) Ctrl+Shift+k
Click the trash can in the upper left corner to clear the existing messages. Then check for new messages after each action, such as:
- Reloading the page (Ctrl+r)
- Navigating to another page
- Clicking buttons, etc.
Does the console mention any issue with blocked content or script errors?
Dit antwoord in context lezen 👍 0Alle antwoorden (2)
Gekozen oplossing
Could you check for messages in Firefox's Web Console. You can open the Web Console in the lower part of the tab using either:
- "3-bar" menu button > Web Developer > Web Console
- (menu bar) Tools > Web Developer > Web Console
- (Windows) Ctrl+Shift+k
Click the trash can in the upper left corner to clear the existing messages. Then check for new messages after each action, such as:
- Reloading the page (Ctrl+r)
- Navigating to another page
- Clicking buttons, etc.
Does the console mention any issue with blocked content or script errors?
Many thanks for your answer. Due to your suggestion I was able to find that in the XML file there was an element containing an accented character and this was the reason because the XML file was not loaded.
Best wishes for the next year!