open local file with XMLHTTPRequest/ActivcXObject

Discussion in 'Javascript' started by acord, Mar 20, 2006.

  1. acord

    acord Guest

    Hi,

    Can anyone tell me how to use XMLHTTPRequest or MS ActivcXObject open a
    local file?

    Thanks
    Sam
     
    acord, Mar 20, 2006
    #1
    1. Advertising

  2. acord

    Alex Guest

    I have posted a week, week and a half code for Firefox, getting text
    and writing to a local file. Search by my name. There are plenty
    examples for IE through google web search.
     
    Alex, Mar 21, 2006
    #2
    1. Advertising

  3. acord wrote:

    > Hi,
    >
    > Can anyone tell me how to use XMLHTTPRequest or MS ActivcXObject open a
    > local file?
    >
    > Thanks
    > Sam


    With regard to HTTPRequest (assuming it is running in a browser, and
    security settings allow), just set the URI to the local file path, and
    then read the text of the file using the responseText property.

    With the ActiveXObject, look up the various objects and properties of
    Scripting.FileSystemObject on the msdn website
    <URL:http://msdn.microsoft.com>

    Regards

    Julian Turner
     
    Julian Turner, Mar 21, 2006
    #3
  4. acord

    Randy Webb Guest

    Julian Turner said the following on 3/21/2006 3:22 AM:
    > acord wrote:
    >
    >> Hi,
    >>
    >> Can anyone tell me how to use XMLHTTPRequest or MS ActivcXObject open a
    >> local file?
    >>
    >> Thanks
    >> Sam

    >
    > With regard to HTTPRequest (assuming it is running in a browser, and
    > security settings allow), just set the URI to the local file path, and
    > then read the text of the file using the responseText property.


    And then, only if it is running from the local file system. If the page
    is on a server, you won't read the file.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Mar 21, 2006
    #4
  5. acord

    Alex Guest

    Well, not true. I can show how you can bypass that in userl.js for YOUR
    browser. Other users will not be able to, not without additional
    entries to user.js, but for your OWN needs, you can make it read YOUR
    files by setting permissions, it will never even prompt you.
     
    Alex, Mar 21, 2006
    #5
  6. acord

    Randy Webb Guest

    Alex said the following on 3/21/2006 9:01 AM:

    Please quote what you are replying to.

    If you want to post a followup via groups.google.com, don't use the
    "Reply" link at the bottom of the article. Click on "show options" at
    the top of the article, then click on the "Reply" at the bottom of the
    article headers.

    <URL: http://www.safalra.com/special/googlegroupsreply/ >

    > Well, not true.


    Yes, it is true.

    > I can show how you can bypass that in userl.js for YOUR browser.


    My IE does not have a userl.js file so that will be hard to show me.

    > Other users will not be able to, not without additional
    > entries to user.js, but for your OWN needs, you can make it read YOUR
    > files by setting permissions, it will never even prompt you.


    If you want to do that, run the file locally and you don't even have to
    edit anything.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Mar 21, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SmViQnVzaGVsbA==?=

    XmlHttpRequest OnReadyState Only Fires on Local Browser

    =?Utf-8?B?SmViQnVzaGVsbA==?=, Jan 11, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    4,297
  2. Lyndon
    Replies:
    1
    Views:
    551
    Leonard Blaisdell
    Jul 25, 2005
  3. Replies:
    5
    Views:
    157
  4. Replies:
    0
    Views:
    168
  5. VK
    Replies:
    24
    Views:
    1,169
Loading...

Share This Page