Solved

JavaScript as stand alone without browser?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

914 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

22 Experts available now in Live!

Get 1:1 Help Now