Jump to content

mrallaire

Members
  • Posts

    7
  • Joined

  • Last visited

mrallaire's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Thank-you for the quick response. Unfortunately I am running the code from my filesystem, so I guess I will just have to use my phone for Google Chrome.
  2. Hello, My HTML, JavaScript, and XML accounting system no longer fully works in Firefox, but does work in Google Chrome. Inspecting the page in Firefox, I see the following error message under the Console tab: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/ Looks to me that synchronous use of XMLHttpRequest has been deprecated, because it sometimes freezes the page while waiting for a response. The only time I used XMLHttpRequest in my JavaScript program is when parsing the XML file. I am parsing the XML file exactly the same way as presently outlined in the W3School XML Tutorial found here: https://www.w3schools.com/xml/tryit.asp?filename=tryxml_parsertest The tutorial does uses Synchronous XMLHttpRequest, as set by 'false' in the line xmlhttp.open("GET", "note.xml", false);. My notes say that asynchronized loading is off to prevent the script from running before the document is fully loaded. I tried to change 'false' to 'true', but that doesn't work either. I am not entirely sure if this is my problem because the W3C Tutorial example still works in Firefox. However the Firefox Console does show the same 'synchronous use of XMLHttpRequest has been deprecated' warning. It also shows a bunch of other warnings. Is my understanding of the problem correct? If so, can you please show how the W3School XML parsing code should now be written? I pasted a copy of the original tutorial code below for convenience: <!DOCTYPE html> <html> <body> <h1>W3Schools Internal Note</h1> <div> <b>To:</b> <span id="to"></span><br> <b>From:</b> <span id="from"></span><br> <b>Message:</b> <span id="message"></span> </div> <script> var xmlhttp, xmlDoc; xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", "note.xml", false); xmlhttp.send(); xmlDoc = xmlhttp.responseXML; document.getElementById("to").innerHTML= xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue; document.getElementById("from").innerHTML= xmlDoc.getElementsByTagName("from")[0].childNodes[0].nodeValue; document.getElementById("message").innerHTML= xmlDoc.getElementsByTagName("body")[0].childNodes[0].nodeValue; </script> </body> </html> The first 5 lines of the script deal with parsing the XML file, the rest of the script inserts the information from the XML file into the webpage. Thank-you kindly for any help!!!
×
×
  • Create New...