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 899319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:11:53+00:00 2026-05-15T15:11:53+00:00

I am building a single HTML page for use in a touch-screen kiosk. I

  • 0

I am building a single HTML page for use in a touch-screen kiosk. I have an external XML file named data.xml which resides in the same directory as my HTML page. I was able to use jQuery to load the external XML file, parse it and build some HTML dynamically on page load without any problems in Firefox and Chrome. But then I tried it in Internet Explorer…

The XML document loads just fine using the $.ajax() function. I did an alert(xmlDoc.text()) and it showed all the text contents of the XML document. So that is not the problem.

I did some searching and found a StackOverflow answer which gives a solution to the problem IF you’re serving the XML from a web server. It basically states that the following HTTP HEADER is needed in order for Internet Explorer to treat the xml string as xml.

content-type:application/xml;charset=utf-8

This HTML page needs to just run as a standalone page inside Internet Explorer. We will not have a web server running on the kiosk machine.

My question is whether there is any way to specify the correct content-type when loading a local resource in jQuery?

Here’s the relevant ajax code I am working with…

$.ajax({
  url: 'data.xml',
  async : false,
  success : function(response) {
    xml = $(response);
  }
});

// Following line works in Firefox/Chrome, but not in Internet Explorer
var firstItemText = $("item:first", xml).text();

EDIT: I have added an error handling function on the ajax request like so…

$.ajax({
  url: 'data.xml',
  async : false,
  dataType : "xml",
  success : function(response) {
    xml = $(response);
  },
  error: function(XMLHttpRequest, textStatus, errorThrown) {
    alert('Data Could Not Be Loaded - '+ textStatus);
  }
});

This function is firing in Internet Explorer and the resulting message is:

Data Could Not Be Loaded: - parsererror

I checked my XML document with several online XML validator tools and it has no errors.

Any help is appreciated.

  • 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-05-15T15:11:54+00:00Added an answer on May 15, 2026 at 3:11 pm

    After some testing I managed to make it work.

    The problem is when you are loading XML files locally, the data received by Internet Explorer is plain-text, not text/xml.

    The solution is:

    $.ajax({
        url: 'data.xml',
    async : false,
    dataType: ($.browser.msie) ? "text" : "xml",
    success : function(response) 
    {
        if (typeof response == "string") 
        {
            xml = new ActiveXObject("Microsoft.XMLDOM");
        xml.async = false;
        xml.loadXML(response);
        } 
        else 
            xml = $(response);
        },
    
    error: function(XMLHttpRequest, textStatus, errorThrown) 
        {
        alert('Data Could Not Be Loaded - '+ textStatus);
    }
    });
    
    var firstItemText = $("item:first", xml).text();
    

    You can see the full explanation in this link:

    http://docs.jquery.com/Specifying_the_Data_Type_for_AJAX_Requests

    I’m glad if I helped.

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

Sidebar

Related Questions

No related questions found

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.