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

  • Home
  • SEARCH
  • 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 6921171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:14:29+00:00 2026-05-27T10:14:29+00:00

I make program to read xml file by using traditional JavaScript. <script type=text/javascript> var

  • 0

I make program to read xml file by using traditional JavaScript.

<script type="text/javascript">
var xmlDoc; 

function loadxml(sImportXML) {
    if( window.ActiveXObject && /Win/.test(navigator.userAgent) ) {
        xmlDoc = new ActiveXObject("Msxml.DOMDocument");
        xmlDoc.async = false;
        xmlDoc.onreadystatechange = function () {
        if (xmlDoc.readyState == 4) readXML();
        }
        xmlDoc.load(sImportXML);
    }
    else if( document.implementation && document.implementation.createDocument ) {
        xmlDoc = document.implementation.createDocument("","",null);
        xmlDoc.async=false;
        alert(sImportXML);
        var loaded = xmlDoc.load(sImportXML);
        if (loaded) {
            readXML();
        }
    }
    else {
        alert("Your browser can\'t handle this script");
        return;
    }
}

 

<body onload="loadxml('../XML/Question.xml');">

Upper loadxml function run correctly at IE but not at firefox.
alert line display this value ../XML/Question.xml.
but xmlDoc.Load function did not run correctly.
It reply error Access to restricted URI denied

Please anyone help me.

  • 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-27T10:14:30+00:00Added an answer on May 27, 2026 at 10:14 am

    In Firefox the javascript will not let you access files on the user’s local file system; there’s simply no way to do it. That would be a huge security breach.

    This works in Internet Explorer with ActiveX because ActiveX is a plug-and-play application module system (kind of like mini browser plugins) where the apps, like ‘Msxml.DOMDocument’, have more power than just javascript and can access files on the user’s local file system.

    But document.implementation is regular javascript, so it has all normal security restrictions, a major one being that the user’s file system is off limits.

    If the XML file is on the server, you can embed in your html code like this:

    <script id="the-xml" type="text/xml">
          ....your xml document contents here....
    </script>
    

    Then you can get the contents in javascript like this:

    var sImportXML = document.getElementById('the-xml').text;
    

    But depending on your application, it might make sense to not use the javascript xml at all. Usually, you’d parse the xml on the server side, and communicate with javascript in json or html snippets.

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

Sidebar

Related Questions

How can I make program in C++ that will read .exe or another file
I'm trying to make a program that read a file line by line and
I want to make a program that will read some number in string format
In a program that I'm writing, I wanted to make a ConfigParser that's read
I have a program that stores it's information in an XML file. This file
i want to make a program which block any file(like autorun.inf),so that no other
We have XML generated from an external program that needs to be read into
I'm trying to make my program read/write in a database. I found this sample
I need to make a program that can read and edit certain .cdb files
I'd like to make program-wide data in a C++ program, without running into pesky

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.