Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8156085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:50:53+00:00 2026-06-06T16:50:53+00:00

The following code works fine in firefox but as with many other things, I

  • 0

The following code works fine in firefox but as with many other things, I cant get it working in Internet explorer (any version).

Can anybody help?

<body>
   <script type="text/javascript">
        if (window.XMLHttpRequest)
            {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp=new XMLHttpRequest();
            }
        else
            {// code for IE6, IE5
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
        xmlhttp.open("GET","messages.xml",false);
        xmlhttp.send();
        xmlDoc=xmlhttp.responseXML;

        var x=xmlDoc.getElementsByTagName("entry");
        for (i=0;i<x.length;i++)
            {
                document.write("<b>From:</b> ");
                document.write(x[i].getElementsByTagName("username")[0].childNodes[0].nodeValue);
                document.write("<br />");
                document.write("<b>Date:</b> ");
                document.write(x[i].getElementsByTagName("date")[0].childNodes[0].nodeValue);
                document.write("<br />");
                document.write("<b>Message:</b> ");
                document.write(x[i].getElementsByTagName("message")[0].childNodes[0].nodeValue);
                document.write("<br />");
                document.write("<br />");

            }
    </script>

</body>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:50:54+00:00Added an answer on June 6, 2026 at 4:50 pm

    Two potential issues spring to mind:

    1. Perhaps your AJAX communication is failing. In which case I would strongly urge you to use a library like JQuery to handle your communication. Then you don’t have to worry about the browser compatibility issues

    2. Secondly, the data coming back from the server is not sent with content-type("application/xml"). Different browsers may behave differently if they cannot reliably detect the content type and know that it’s XML that you’re expecting.

    [Edit]

    This is a full working example that I tested in IE7

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
     <head>
       <title></title>
     </head>
     <body>
        <script type="text/javascript">
             if (window.XMLHttpRequest)
                 {// code for IE7+, Firefox, Chrome, Opera, Safari
                     xmlhttp=new XMLHttpRequest();
                 }
             else
                 {// code for IE6, IE5
                     xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                 }
             xmlhttp.open("GET","messages.xml",false);
             xmlhttp.send();
             xmlDoc=xmlhttp.responseXML;
    
             var x=xmlDoc.getElementsByTagName("entry");
             for (i=0;i<x.length;i++)
                 {
                     document.write("<b>From:</b> ");
                     document.write(x[i].getElementsByTagName("username")[0].childNodes[0].nodeValue);
                     document.write("<br />");
                     document.write("<b>Date:</b> ");
                     document.write(x[i].getElementsByTagName("date")[0].childNodes[0].nodeValue);
                     document.write("<br />");
                     document.write("<b>Message:</b> ");
                     document.write(x[i].getElementsByTagName("message")[0].childNodes[0].nodeValue);
                     document.write("<br />");
                     document.write("<br />");
    
                 }
         </script>
    
         <div>Hi</div>
    
    </body>
    </html>
    

    And the test data from messages.xml also located at the root of my server

    <?xml version="1.0"?>
    <root>
        <entry>
            <username>A</username>
            <date>B</date>
            <message>C</message>
        </entry>
    </root>
    

    This produces the following output

    From: A
    Date: B
    Message: C
    
    Hi
    

    IE is a pain to debug because it has very limited debugging tools. I checked with FireFox’s FireBug add-on to see that the content-type from my WAMP server was “application/xml”.

    content-type=application/xml

    You should also make sure that your XML document is valid by running it through a validator.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code. It works fine in firefox but is not working in
The following code works fine in most browsers but it won't work in Internet
I have following code which works fine in firefox and ie 8, but in
The following code works fine in chrome and Firefox, but breaks in IE 9.0
In chrome and safari, the following code works fine. in firefox , all platforms,
The following code works fine on Linux but throws an exception on OS X
I have the following line of code that works fine in Firefox, Chrome and
I'm using the following code for star rating. The code works fine in firefox
The following code works fine as a independant page as itself. But if incorporated
I have a problem accessing the 'event' in Firefox. The following code works fine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.