Cross-platform javascript apps
December 23, 2011 11:59 AM   Subscribe

I'm working on a program that I want to be cross-platform, and someone suggested writing it in Javascript and using a javascript/html5 engine to display it without using a web browser. Are there any resources to get me started on this?

I don't seem to know the keywords, and while I'm an accomplished scripting programmer, I don't know C or C++ well enough to integrate WebKit or SpiderMonkey or similar into a desktop app... or even where to get started on that.

It seems to me like there should be a pre-made executable project that'd let you do this. I sort of just need a starting point, and most of what I've turned up assumed that I'd be writing for WebOS ... right idea, wrong platform.
posted by SpecialK to Technology (11 answers total) 4 users marked this as a favorite
Mozilla Prism?
posted by eschatfische at 12:01 PM on December 23, 2011

Ah, I should point out the caveat that this will not necessarily be an always-on internet connected application. (It'll run offline and server communication is completely optional.)
posted by SpecialK at 12:10 PM on December 23, 2011

If you are willing to require the Chrome browser, check out Packaged Apps. This is how Angry Birds for Chrome works.
posted by indyz at 12:47 PM on December 23, 2011

This sounds kinda bad to me but I admit to being a bit prejudiced against javascript. I would so much rather write it in a scripting language and use one of the graphical toolkits. Tcl/tk, python with whichever gui kit they use that you like (there are several, many of them are cross platform). It's always seemed like a lot of work to make javascript do (kind of slowly) what most scripting/gui toolkits do pretty easily.
posted by RustyBrooks at 1:03 PM on December 23, 2011 [1 favorite]

Tagging on to what RustyBrooks said, PyGame is nice cross-platform toolkit that combines Python and SDL. There is a large community behind it, so tons of add-ons, tutorials, etc.
posted by indyz at 1:16 PM on December 23, 2011

Adobe Air would be my recommendation for this.
posted by toomuchpete at 1:34 PM on December 23, 2011 [1 favorite]

Echoing Pete. I'd look at Air.
posted by bitdamaged at 2:30 PM on December 23, 2011

This is impossible to answer without knowing, generally, what the application will do, what platforms you need to support, etc. If you need to access the file system, or any other operating system level functionality of the system, something like Prism (or the chromium equivalent, Pokki), might not be suitable. Also, I'm not sure if applications built with those tools can operate offline.

The next option is a write once, run anywhere solution, such as Adobe AIR, wxPython, GTK+, Qt, etc. This can work but depending on the choice you may have to put time into the install/upgrade functionality. Also, your app will look "non native" on all platforms, which may or may not be an issue.

The elegant way is to decouple your core logic from your UI/Presentation and write a per-platform native UI implementation.

The nuclear option is to build a native app that embeds your html/css/js in a web browser control. Mozilla isn't committed to offering an embeddable browser component, but there is a third party project to do so for chromium: Chromium Embedded Framework (CEF). This would definitely require some comfort with c/c++.
posted by outlaw of averages at 10:06 PM on December 23, 2011

If you do end up writing in javascript, I have found the w3schools site a helpful reference for Javascript/HTML. Lots of examples.
posted by sarah_pdx at 12:51 AM on December 25, 2011

What do you mean by cross-platform? Does that mean Mac OX X, Windows 7? Does it imply iOS, Android, Windows Phone 7? If it runs in another runtime - like Google Chrome, or Firefox, or Adobe Air, is that satisfactory?
posted by artlung at 9:37 AM on December 26, 2011

« Older I love it when a plan comes together   |   DIY lamp project Newer »
This thread is closed to new comments.