SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2001
    0 Post(s)
    0 Thread(s)

    Can javascript read txt files ?

    Is it possible for a javascript code to read a certain .txt file in another directory, and use that content as a variable ?

    The reason why I ask: I have an application that outputs a small txt file every 10 seconds, and I want the browser to check that txt file, even after the rest of the page has loaded .Then that text would be used by javascript and show it in the status bar as some kind of news ticker.

    I know how to do this in php, but the problem is that the ticker wont have "fresh" text then anymore, as php would stop working as soon as the page has been fully displayed.

    So I need some way to read that txt file every 10 seconds after the page has loaded, and with javascript I could do that... if only I knew how to read a file with javascript.

    Is it possible or not ? (I seriously doubt it )

    Or are there any other ways to perform what I want ?

  2. #2
    SitePoint Guru
    Join Date
    Jan 2001
    Alkmaar, Netherlands
    0 Post(s)
    0 Thread(s)
    XMLHTTP component from microsoft. You can use it client side also if IE5.5 or higher is installed. Search for it.


Posting Permissions

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