3

I wonder if there is a 'local runtime environment' for hosting Javascript code, that's not browser based, for running small local apps? Something like WSH (Windows Scripting Host) for JavaScript (not MS-JScript).

I would like to run some javascript scripts locally, like I might for VBScript (VBS), with the possibility of some of the following:

  1. Access to local files (perhaps via an FSO object)
  2. Simple console read/write
  3. Recent version of Javascript
  4. Some form of simple debug

Alternatively, how might one consider running a browser in 'local' mode only? ie: launch, run-code, exit, perhaps with command-line switches/options, without too much overhead? If so, which browser? FireFox? Might it be possible to somehow 'extract' the JS runtime engine/DLL and call that?

So, in brief, something like WSH just for javascript?

Thanks.

andora
  • 1,241
  • 1
  • 12
  • 23

4 Answers4

6

http://nodejs.org/ gives you javascript running on V8.

It runs on Mac, Linux and Windows and gives you access to a huge number of libraries in very rapid development using the Node Package Manager(NPM).

If you want to do serverside/local javascript, this is what you should use and not some proprietary windows environment.

The Roy
  • 1,999
  • 1
  • 12
  • 27
Munter
  • 1,069
  • 5
  • 7
  • Have you ever use this nodejs in an standalone (no web) application? Do you have to include multiple files to use it? – David Laberge Nov 22 '11 at 12:03
  • Our companys web application build system is based on NodeJS. It builds web apps, but it isn't a webapp itself, so I guess that counts as standalone. About the multiple files, you need the files of your required libraries of course. It is a scripting language afterall – Munter Nov 22 '11 at 12:13
  • sorry if I sound annoying. Could you run the NodeJs on a windows machine with no access to web, without apache or IIS running on the local PC? I'm really curious about that solution. – David Laberge Nov 22 '11 at 13:31
  • You can. You can use it for any scripting on the local machine as long as there is an API for it. And you can acually use node to replace your Apache/IIS setup if you want to. I recommend the NodeJS Express module – Munter Nov 22 '11 at 14:05
1

What you are looking for is called HTA. (Documentation)

In HTA you can use jQuery, javascript, HTML, FSO, EXCEL, Command Line it works great.

The down side. It works only on Windows and with the IE rendering engine.

David Laberge
  • 13,061
  • 14
  • 51
  • 82
  • Thanks David, I'd completely forgot about HTAs! Do you know if they work with whatever IE is installed locally or do they need some specific version? – andora Nov 22 '11 at 11:55
  • Yes totally, but you are still stuck with the issue of IE. IE6 on win2k is not better then it is on the web :( – David Laberge Nov 22 '11 at 11:59
  • But if it is using IE then it is using JScript (which has been specifically excluded) and not JavaScript. – Quentin Nov 22 '11 at 12:07
  • @Quentin Are you telling me that IE does not use javaScript. Then why jQuery is working? Please shed some light on your comment I'm not sure to follow. – David Laberge Nov 22 '11 at 12:10
  • @David Laberge — IE has a JScript engine, so jQuery can run just fine. – Quentin Nov 22 '11 at 12:10
  • @Quentin I'have been doing HTA for over a year and I NEVER knew, I'll look into it. – David Laberge Nov 22 '11 at 12:14
  • @David Laberge — Since the differences between JScript and JavaScript are the letters "ava" and a trademark that used to be owned by Sun, there's no technical reason to care (which makes the original question rather odd). – Quentin Nov 22 '11 at 12:15
  • @David/@Quentin: I want/wanted full javascript compatibility. I understood (perhaps wrongly) that JScript had some specific MS functions and was an 'early' version. If IE runs jQuery, thats good enough for me. Thanks. – andora Dec 12 '11 at 16:32
  • @andora I have been using HTA with jQuery, jQuery UI for over a year in my work setting. It works fine. – David Laberge Dec 13 '11 at 13:32
1

WSH can run Chakra, which is EcmaScript 5.

Community
  • 1
  • 1
Cheeso
  • 180,104
  • 92
  • 446
  • 681
0

node.js is largely used for server apps, but it's quite usable for command line tools as well.

Matti Virkkunen
  • 58,926
  • 7
  • 111
  • 152