Solved

JavaScript as stand alone without browser?

Posted on 2012-03-24
4
444 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 82

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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-…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now