Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you convert HTML, CSS, and Javascript into a EXE? [closed]

All of the answers to this question so far as I can see are confusing... can someone give me a detailed way to make EXE apps with HTML?

like image 487
Evolve Digital Avatar asked Feb 15 '14 23:02

Evolve Digital


People also ask

Can you convert html to exe?

1) Download Visual Studio Express Edition(Because it's free). 2) File -> New Project -> Windows Forms Application. 3) Load your current HTML into it. 4) Add WebBrowser control to your project.

Can you compile JavaScript to exe?

Two of the most commonly used packages used to compile JavaScript files into executables are: nexe: It is a simple command-line utility that compiles your Node. js application into a single executable file. By default, it converts it into a Windows executable.


4 Answers

No. In the strict sense you can't. HTML was mainly invented to design and exchange documents written for a browser (and CSS provides layout information for such a document).

Although, that is not the case anymore. There are many possibilities, where HTML and CSS is used outside of the browser (e.g Gnome Shell is developed with the help of CSS and Javascript or think of Modern UI apps for Windows 8).

So if you consider Windows 8, there is the possibility of creating an app outside of the browser; but technically it is not an .exe It is not an executable.

Another possibility is to make use of the WebBrowser Class, which allows you to write an .exe which makes use of your HTML and CSS.

So there are ways to stuff HTML into an executable, but you can not make it executable by itself, since it is a document/markup language and not a programming language and can not be converted to running code.

like image 110
Thomas Junk Avatar answered Oct 01 '22 08:10

Thomas Junk


There are several possible directions here, and I can't be sure what you really want.

  1. If you have a static HTML site, you can load it into any web browser from a local disk. This is exactly how "Save as complete web page" functionality works in all major browsers. You can even put this on a CD/DVD and cause Window's autorun feature to automatically load it in a web browser. This method (or some variation) is probably what you want.

  2. If it is a non-trivial web app, then it is already an executable, albeit on the server, not the client. (I assume this is not the case). This cannot easily be converted to a desktop app, for reasons obvious to anyone with the skill to do so.

  3. If you want to make the UI of an application via HTML/CSS, that's a whole different story. Its a means to an end; the app is the actual product. But this involves making a real exe: still no cheating.

  4. So, okay. Despite the "no-cheating" claim above, it is possible to build an application using Javascript as the programming language. In this case it is an "executable", but not really an .exe: it's a .js file. You would need a standalone Javascript interpreter for this. But this doesn't necessarily involve any HTML or CSS at all: Javascript is a programming language in its own right, just like the ones other apps are build with.

So no, HTML is not put into executables strictly for viewing pleasure. Its technically possible, but also infeasible: far better solutions already exist. E.g. how do you justify choosing which browser to integrate? Will you force every user to use your exe browser instead of their favorite?

like image 20
jpaugh Avatar answered Oct 01 '22 08:10

jpaugh


HTML is a language similar to XML - it is interpreted, not compiled. Thus, you cannot make MS Windows executable files (*.exe) with HTML.

like image 26
Shocked Avatar answered Oct 01 '22 08:10

Shocked


This is a common misconception. HTML is a markup language, which means it must be interpreted by an engine that can display the actual visuals that HTML encodes.

One cannot simply compile HTML, CSS, and JavaScript into an executable file. These are all merely scripting, styling, and markup languages that must be interpreted by an engine (which in many cases is executable).

In Visual Studio 2010 you can create a simple window with a WebView element, and you can populate this element with custom HTML, and inject JS, and so forth. This is described more in depth here: http://blogs.msdn.com/b/wsdevsol/archive/2012/10/18/nine-things-you-need-to-know-about-webview.aspx

Finally, you may be thinking about Visual Studio 2013, which allows you to use JavaScript.

JavaScript is a first-class language in Visual Studio 2013. You can use most or all of the standard editing aids (code snippets, IntelliSense, and so on) when you write JavaScript code in the Visual Studio IDE. You can write JavaScript code for Windows Store apps and Web apps in Visual Studio.

However, keep in mind that all of your JavaScript gets compiled down into the CLR (Common Language Runtime) which can be read about more here: http://en.wikipedia.org/wiki/Common_Language_Runtime

like image 23
turnt Avatar answered Oct 01 '22 07:10

turnt