views:

292

answers:

7

I have an HTML file with embedded Javascript, and I want to convert it to a stand-alone exe.

Is that possible? How can I do it? Any html2exe tool out there?

P.S. If you must ask why, it's a very simple text-processing utility, but certain people want it (for reasons beyond me) as a desktop application.

+1  A: 

Here is an article explaining how to use a compiler from Micorosft. It's not exactly what you want, but it's a start, so I figured I would post it:

http://www.phpied.com/make-your-javascript-a-windows-exe/

It won't parse the HTML to make a GUI, but at least you can modify the JS code a little to compile, and then build a new UI on top of it.

Kevin
+3  A: 

If your desktops are limited to Windows have you considered creating it as a HTML Application?

You get the ability to launch from the desktop with out the need to create an EXE.

AnthonyWJones
A: 

Surely your desktop application is your browser ? Can you create a standalone .html file that contains the Javascript within it (rather than referenced via a separate URL/.js file). Plus the .css etc.

Then you can distribute that HTML file. Double-clicking it will launch it in the browser, and with no requirements on a remote server.

Brian Agnew
+4  A: 

What about using something like Mozilla Prism or Google Gears

The Prism site says

"Prism (formerly, Webrunner) is a prototype application that lets users split web applications out of their browser and run them directly on their desktop."

neilc
+4  A: 

While there isn't a html2exe tool that I know of, you can realize this by packing your html file with a standalone browser.

It should be easy to do this with the QT Webkit Widget. Webkit is a mature browser engine and is used by google chrome for example.

You simply need to point the browser widget to your html file, don't add any address bars or navigation buttons and maybe strip such functionality from the widget. The program now shouldn't resemble a browser anymore and looks just like a normal application.

Otto Allmendinger
+1 for QT, that thing looks pretty good
Dan F
yay, way to go for Qt!
Here Be Wolves
Hmm, webkit! Good idea, does it support javascript though?
hasen j
+4  A: 

They don't generate an exe but you may be interested in looking into Adobe AIR and its opensource rival Titanium

Massimiliano Torromeo
+1  A: 

Depends on how complex the page is.

If it's a one pager, would a .hta work for you?

If it's multiple pages, you could use the IE Webbrowser control (or geckofx ) and a HTTPListener

Or you could host the asp.net runtime yourself.

In the past I've had success with the Webbrowser and injecting the HTML "by hand" (including all required scripts), but I wouldn't recommend it. It was a teeth grinding debugging nightmare. I kept going because it was "fun" :-)

Dan F