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
Solved

JavaScript as stand alone without browser?

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

840 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