Results 1 to 3 of 3

Thread: IS there any way to avoid ActiveXObject in javascript for reading documents ?

  1. #1
    Join Date
    Oct 2013

    IS there any way to avoid ActiveXObject in javascript for reading documents ?

    In need of desperate guidance

    1. Is there any way to avoid ActivexObject in JavaScript for reading documents and constructing xmls?

    2. Actual there is a problem with the client, he doesn’t like the IE security settings like "Access data source across domains" under Miscellaneous and "Run ActiveX controls and plug-ins".

    And It should support IE 7, 8 and above. If possible that should work in cross browser also.

    Currently in JavaScript, we are using the below codes:

    var xmlDoc = new ActiveXObject("MSXML2.DOMDocument"); -->for xml construction.

    var stm = new ActiveXObject("ADODB.Stream"); --> for reading the doc and docx file from client temporary path.

    What is needed:

    1. We need to find an alternate in order to avoid using the ActiveXobject.


    2. We need to automate the Internet Security Settings in client machine.

    Could some one help me in this please?


  2. #2
    Join Date
    Mar 2007
    You could have the documents uploaded to the server, have the server parse the file to get the data out, when the client has finished with that file, delete it off the server.

    This all depends on what your objectives are with accessing the data in this way.
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  3. #3
    Join Date
    Feb 2003
    Michigan, USA
    You could try out Dean Edward's solution: http://dean.edwards.name/weblog/2006/04/easy-xml/

    Basically you create a new element with the tag name set to "xml". Then set the "src" property to the URL of an XML file.

    Another way would be to load the XML document in an IFRAME from a URL in the same domain as the current Web page. As long as the XML document in the IFRAME is in the same domain name as the parent page, JavaScript can access the window and document objects inside the IFRAME, and therefore JavaScript can extract those values.

    Perhaps something like this?

    function loadXML(url, callback, context) {
        var iframe = document.createElement("iframe");
        iframe.onload = function() {
            callback.call(context, iframe.contentDocument);
            iframe.onload = null;
            iframe = callback = context = null;
        iframe.src = url;
    You would use it like this:

    HTML Code:
    <script type="text/javascript">
        // Procedural or Functional code:
        loadXML("/data.xml", function(doc) {
            $(doc).find("foo").each(function() {
                // do stuff
        // Object oriented code:
        var someObject = {
            foo: function() {
                loadXML("/data.xml", function(doc) {
                }, this); // Notice the third argument: "this" sets the value of "this" in the callback
            extractData: function(doc) {
                $(doc).find("foo").each(function() {
                    // do stuff
    Note: This is untested code

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center