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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:07:04+00:00 2026-06-03T03:07:04+00:00

I was wondering if somebody could help me with this, I’ve seen a few

  • 0

I was wondering if somebody could help me with this, I’ve seen a few examples using the XDomainRequest on the web, but they don’t really explain the code that well. I am trying to load an XML file, so I can parse it. The code I am using is below.

    var xdr = new XDomainRequest();             
           xdr.onerror = 
           function () 
           {
                    alert('Error!');
           };               
           xdr.ontimeout = 
           function () 
           {
                    alert('Timeout!');
           };

           xdr.onprogress = 
           function () 
           {
                    alert('Loading...');
           };
           xdr.onload = 
           function() 
           {
                    alert('File:' + xdr.responseText);
           }

           xdr.timeout = 10000;
           xdr.open("GET","http://www.spectraltechnologies.co.uk/webbuilder2020/Instrument_Lamps_New.txt", false);
           xdr.send();

Everytime I try and use this it always returns xdr.onerror and the accompanying alert. The file it requests was originally an XML file and is in XML format inside but I have made a .txt copy, as I understand this is the only thing XDomainRequest accepts.

I have been able to make a solution for Firefox and Chrome browsers, but Internet Explorer has caused me many problems. I really hope someone can help, thanks in advance.

  • 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-03T03:07:04+00:00Added an answer on June 3, 2026 at 3:07 am

    I worked this out by persisting through the long and very specific specification of the XDomainRequest. My first issue was that the response header from the file/site, I was accessing was incorrect.

    This site used a “.htaccess” file, so I was able to fix this issue by adding the below code:

        <filesMatch "\Instrument_Lamps_New.txt$">
        <IfModule mod_headers.c>
        Header add Access-Control-Allow-Origin "*"
        </IfModule>
        </filesMatch>
    

    This code checks if the file being accessed, is the one I want the specified header for and then adds that to the header.

    My second issue is that using XDomainRequest, you can only access files with the same protocol as the file you are opening the request from. i.e. http only opens http, https only opens https. Due to debugging the site, I was opening the page from my own file system, so the error occurred due to “file://…” ≠ “http://…”.

    So after making sure my response header included the “Access-Control-Allow-Origin” header and I uploaded the page it worked fine.

    This site includes more information on XDomainRequest:
    http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx

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

Sidebar

Related Questions

I never seen this but I wondering if somebody has come across. Having a
Was wondering if somebody could please help me solve this. I've follwed all steps
I'm learning Javascript (mainly using JQuery) and was wondering if somebody could help me.
Wondering if somebody could help me figuring this out, I have a list; basically
I was wondering if somebody could help me with how exactly to write some
Hi guys just wondering if somebody could help me try and correctly thread my
I was wondering if somebody could help me, I can do it on pen
i was wondering if somebody could help me out. I have a plan of
I was wondering if somebody could shed some light on this browser behaviour: I
Hi there I was wondering if somebody could help me? I have the following

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.