Solved

JavaScript as stand alone without browser?

Posted on 2012-03-24
4
467 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 83

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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

632 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