Results 1 to 13 of 13

Thread: read files with javascript

  1. #1

    Thread Starter
    Fanatic Member Mushroom Realm's Avatar
    Join Date
    Mar 2002
    Location
    Murrieta, California
    Posts
    650

    read files with javascript

    How do u use javascript to write to an on server file. How do u open it back up to read it.

  2. #2
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    javascript only works on the client side it cannot do server side work. You will need to use PHP, Perl, ColdFusion, ASP, or Java
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  3. #3
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    I think you can use JavaScript server-side, that's what I read on a JavaScript tutorial on the Netscape developer site anyway.

  4. #4
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    you can use javascript inside a server side script but javascript cannot interact with the server. (that would provide tens of thousands of ways a hacker could maliciously access your server)
    Last edited by cpradio; Aug 7th, 2002 at 02:46 PM.
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  5. #5
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    Oh right. I seem to remeber the site saying that the only things it adds are the ability to read and write files when used server-side.

  6. #6
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Server-side javascript is known as Livewire. If you have a netscape 2+ server with the Livewire extensions installed you can create a development environment like CGI, PHP etc.

    http://oradb1.jinr.ru/netscape/wssja/jsserv.htm
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  7. #7
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    Wow I never knew that, although that's not really saying much

  8. #8
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Javascript is not really client-side or server-side. All you need is some kind of host that provides objects for an embedded javascript interpreter to access. A web browser is the most common javascript host around because that's what it was created for, but, AFAIK, there's nothing in the Javascript / ECMAScript specs that specifically define it as client or server side, so you could add it to a web server, or you could put a javascript interpreter inside a Office Suite to allow Macro functionality. Conversely, if you put a PHP or Perl interpreter inside a browser, you have client-side PHP or Perl. (Perl can run inside IE with ActiveState's distro, but I don't know if this has been done with PHP yet)
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  9. #9

    Thread Starter
    Fanatic Member Mushroom Realm's Avatar
    Join Date
    Mar 2002
    Location
    Murrieta, California
    Posts
    650
    Basically im trying to create a chat room, and i figured the easiest way to do it is by having a text box and a button, when they click the button it writes to a file and every second it reloads the file. This way everyone can see the file. Is that server side or client-side

  10. #10
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    The form submission handling and writing of the file would be server-side.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  11. #11
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Javascript is not really client-side or server-side...
    Thats a good point Josh. To be honest, I don't see why, in todays world, you would need to use server-side javascript when there are so many server-side technologies and languages around. I think php would be the way to go as it shares syntax with c, similar to javascript.

    Do you happen to know of any hosts that support server-side javascript?
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  12. #12
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Well, using JScript with ASP is pretty much the same as using server-side javascript. I'm fairly certain MS uses the same Jscript engine for JScript as it does javascript inside IE (or anywhere else). You probably could also set IIS (and probably Apache on Windows) to run *.js files as CGI thru WSH.

    If you already know javascript syntax (from using it on your web pages), and you don't know PHP, why not use server-side javascript if its available? Then again, javascript has only a handful of built-in objects, so it would have to rely on the host/server to supply it with a good library to use. There's no native network or database connectivity or file i/o objects built into javascript natively (for good reason), which is why you don't see server-side javascript used too often.

    And who says PHP is a server-side technology? AFAIK, they're working on TK (or whatever) libraries so you can write stand-alone GUI apps not in need of a client or a server.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  13. #13
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    And who says PHP is a server-side technology? AFAIK, they're working on TK (or whatever) libraries so you can write stand-alone GUI apps not in need of a client or a server.
    Another good point, I'll have to have a look into that. Thanks for the information.
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

Posting Permissions

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



Click Here to Expand Forum to Full Width