X
Tap here to go to the mobile version of the site.

Support Forum

XMLHttpRequest() not working anymore

Posted

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>&nbsp;&nbsp;Dati alle ore&nbsp;&nbsp;</b></td>
    <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b>&nbsp;&nbsp;Temperatura&nbsp;&nbsp;</b></td>
    <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b>&nbsp;&nbsp;Umidit&agrave;&nbsp;&nbsp;</b></td>
    <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b>&nbsp;&nbsp;&nbsp;Vento km/h&nbsp;&nbsp;&nbsp;</b></td>
    <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b>&nbsp;&nbsp;&nbsp;&nbsp;Pressione&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>
    <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b>&nbsp;&nbsp;Pioggia odierna&nbsp;&nbsp;</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> &deg;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>
……
…...
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 <pre><nowiki> <table border="0" width="100%"> <tr> <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b>&nbsp;&nbsp;Dati alle ore&nbsp;&nbsp;</b></td> <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b>&nbsp;&nbsp;Temperatura&nbsp;&nbsp;</b></td> <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b>&nbsp;&nbsp;Umidit&agrave;&nbsp;&nbsp;</b></td> <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b>&nbsp;&nbsp;&nbsp;Vento km/h&nbsp;&nbsp;&nbsp;</b></td> <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b>&nbsp;&nbsp;&nbsp;&nbsp;Pressione&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td> <td bgcolor="#ccffcc"><center><font face="Verdana" size=5><b>&nbsp;&nbsp;Pioggia odierna&nbsp;&nbsp;</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> &deg;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> </nowiki></pre> Part of XML file <pre><nowiki> <?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> …… …...</nowiki></pre>

Modified by cor-el

Chosen solution

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?

Read this answer in context 0
Quote

Additional System Details

Installed Plug-ins

no plugin

Application

  • User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15

More Information

jscher2000
  • Top 10 Contributor
8885 solutions 72683 answers

Chosen Solution

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?

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?
Was this helpful to you?
Quote

Question owner

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!

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!
Was this helpful to you?
Quote
Ask a question

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.