Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

JavaScript as stand alone without browser?

Posted on 2012-03-24
4
Medium Priority
?
475 Views
Last Modified: 2012-04-14
Is there a way to run a JavaScript program as a stand alone program instead of in a web browser?

Specifically, I like the way http://prettydiff.com/ beeautifies HTML code, but the cut/paste to/from the web browser window is tedious. I downloaded markup_beauty.js from the website, plus a dozen other *.js files that might go with it, plus there's a page of documentation at http://prettydiff.com/documentation.php

But I'm not sure how to proceed.
markup-beauty.js
0
Comment
Question by:deleyd
  • 2
4 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 37762051
This version from Google http://code.google.com/p/v8/ says it can run standalone.  But you have to 'build' it yourself, it's not a binary.  Some others are listed here http://en.wikipedia.org/wiki/JavaScript_engine but I'm not sure how many are standalone.
0
 
LVL 7

Expert Comment

by:Lalit Chandra
ID: 37763041
you can refer to know more in depth

http://stackoverflow.com/questions/1075600/running-javascript-standalone-engine

But,if you directly go to use/run then visit

1.      https://developer.mozilla.org/en/SpiderMonkey
2.      http://www.mozilla.org/rhino/
0
 

Accepted Solution

by:
deleyd earned 0 total points
ID: 37823712
I got the solution from the author. He gave me this file, wsh.wsf (which I tried to upload but couldn't because .wsf is not on the list of approved extensions).

Windows Scripting Host can run JavaScript files.

To pass the parameters to the JavaScript file I needed a special wsh.wsf file. The instructions then are:

Save file wsh.wpf to your downloads of markup_beauty.js and markupmin.js

Then open a command prompt in windows.  Navigate to the directly where the three files are then type:

cscript wsh.wsf /source:"name_of_your_file.xml"

Remember that the HTML option is off by default, so if prefer to use this tool with HTML then you need to turn that option on:

cscript wsh.wsf /source:"name_of_your_file.html" /html:true
wsh.wsf.txt
0
 

Author Closing Comment

by:deleyd
ID: 37845928
Got answer from author.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question