NWJS => transform your web soft in a standalone software

For discussions about game development that does not fit in any of the other topics.
Post Reply
User avatar
a_bertrand
Posts: 1537
Joined: Mon Feb 25, 2013 1:46 pm

NWJS => transform your web soft in a standalone software

Post by a_bertrand »

Ever wanted to transform your web software into a standalone software allowing people to download it, and then use it even offline? Well it's possible and actually easier than you may think.

I know there is multiple ways to do it, but I will talk about one open source solution only: NW.JS
https://nwjs.io/

NW.JS is basically a chrome browser modified with node.js together merged. With that you can transform any HTML + JS software into a standalone application, being for Linux, Windows or Mac OSX.

Keep in mind the end-result is not a small application (the base thing is about 190Mb un-compressed and about 50 Mb compressed).

So where do you start?
http://docs.nwjs.io/en/latest/For%20Use ... 20Started/

Basically you just need to define a package.json file containing the main html file to open. Once that's done, you are basically up and running.

But what can you do with nw.js that you can't do with chrome alone? Well many things. For example you have access to menu bars, you don't have all the chrome look & feel. You can open file dialog boxes without having the "input file" tag visible and you can access all the Node.JS functionalities from within the "browser".

Keep in mind there is 2 main versions of NW.JS: one is the dev version which allows F11 key to open the browser debug window, and the production version which doesn't have it.

To deliver your soft, you can pack all your html, js and resources into a zip and rename it package.nw. Place that in the same directory as the exe, and when you start the exe it will open your soft. Or you can merge the exe with your zip.

The end result of your work will be a software which share the same code and resources as your web software (or at least mostly), yet run offline without any need of Internet and which can offer a few more goodies.

For info, that's what I'm using to produce my standalone version of Dot World Maker and I can tell you I'm really impressed by the results.
Creator of Dot World Maker
Mad programmer and annoying composer
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: NWJS => transform your web soft in a standalone software

Post by hallsofvallhalla »

thanks for the write up. Now if only we could do this in reverse easily. Turn any program into a web based program :P
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: NWJS => transform your web soft in a standalone software

Post by Jackolantern »

hallsofvallhalla wrote:thanks for the write up. Now if only we could do this in reverse easily. Turn any program into a web based program :P

Web Assembly is coming! And then yes, we will be able to do just that!

As for NW.JS, as odd as it seems, for desktop applications, I am not worried about that bump-up in size. It may seem counter-intuitive, but people tend to look down on small desktop applications. Particularly if they are games. Like if you spent $400 on a desktop application and then saw the size was 1mb, you may feel ripped-off. But when you go to download Adobe CS4 and you see the download is 4 or 5gb, it just gives you a feeling that you are getting your money worth. Stupid I know, but a lot of people feel this way.
The indelible lord of tl;dr
Post Reply

Return to “General Development”