#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    3
    Rep Power
    0

    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.

    OR

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

    Could some one help me in this please?

    Thanks
    Nanda
  2. #2
  3. No Profile Picture
    Super Moderator
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,008
    Rep Power
    2791
    Welcome to DevShed, nnithiyanand.

    What are you doing with the data? Editing the documents?
    [PHP] | [Perl] | [Python] | [Java] != [JavaScript] | [XML] | [ANSI C] | [C++] | [LUA] | [MySQL] | [FirebirdSQL] | [PostgreSQL] | [HTML] | [XHTML] | [CSS]

    W3Fools - A W3Schools Intervention.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    3
    Rep Power
    0
    Originally Posted by Winters
    Welcome to DevShed, nnithiyanand.

    What are you doing with the data? Editing the documents?
    Thanks Winter,

    What are you doing with the data? Editing the documents?

    Answer: Just will be accessing the document and convert the whole document into base64 and assinging into an server control.(Asp.Net).

    Need an alterante for ActiveXObject("ADODB.Stream") in order to access documents.
  6. #4
  7. No Profile Picture
    Super Moderator
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,008
    Rep Power
    2791
    Is there a specific reason that you need to perform those actions in a client-side browser? Why not upload the document and perform those actions on the server-side?
    [PHP] | [Perl] | [Python] | [Java] != [JavaScript] | [XML] | [ANSI C] | [C++] | [LUA] | [MySQL] | [FirebirdSQL] | [PostgreSQL] | [HTML] | [XHTML] | [CSS]

    W3Fools - A W3Schools Intervention.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    3
    Rep Power
    0
    Originally Posted by Winters
    Is there a specific reason that you need to perform those actions in a client-side browser? Why not upload the document and perform those actions on the server-side?
    Exactly the point.

    But we are creating this document on client side only, not on server side.

    And inorder to upload , first we need to read the file ,for that we are making use of this var stm = new ActiveXObject("ADODB.Stream"). So this were got stuck up and lookin for the replacment because of clients request to avoid the settings in IE.

    Please see the example below.

    Example:

    var stm = new ActiveXObject("ADODB.Stream");
    stm.Open();
    stm.LoadFromFile("c:\document.doc");
    var bytes = stm.Read();
  10. #6
  11. No Profile Picture
    Super Moderator
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,008
    Rep Power
    2791
    I'm not really following you. Are you trying to automate the upload process? If not, why not use a form to upload the document to the server?

    In what type of environment is this software being used? It is a serious security risk to use such an open-ended tunnel to the client-machine. You are bypassing all browser security features.

    If you have to automate the process, I would suggest a dedicated application to handle the data transfer, not something as dangerous as a web browser.

    [EDIT] Sorry, misread your last post.
    Last edited by Winters; October 30th, 2013 at 08:16 AM.
    [PHP] | [Perl] | [Python] | [Java] != [JavaScript] | [XML] | [ANSI C] | [C++] | [LUA] | [MySQL] | [FirebirdSQL] | [PostgreSQL] | [HTML] | [XHTML] | [CSS]

    W3Fools - A W3Schools Intervention.
  12. #7
  13. No Profile Picture
    Super Moderator
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,008
    Rep Power
    2791
    Long story; short. You cannot do anything else. Browsers have a lot of security to prevent unauthorised access to a client machine. ActiveX, for better or worse, bypasses that security. If you a) Need to do this client-side and b) need to use a web browser and, finally, c) cannot upload to the server, then you have no other options.

    Can you not upload the data to the server normally, then send it back to the client browser?
    [PHP] | [Perl] | [Python] | [Java] != [JavaScript] | [XML] | [ANSI C] | [C++] | [LUA] | [MySQL] | [FirebirdSQL] | [PostgreSQL] | [HTML] | [XHTML] | [CSS]

    W3Fools - A W3Schools Intervention.

IMN logo majestic logo threadwatch logo seochat tools logo