Combine browser and web app for deployment - javascript

What's the best way to turn an HTML/Javascript web app into a self-contained app that can be run from Windows (and maybe Mac/Linux) PC's? Preferably without any installation, ie a network share.
I have looked into Chrome and Firefox Portable, but these require write access to the folder, so are unsuitable for running off a read-only network share.
(some background, I have a big javascript app but many of my clients are using IE6 or 7. Their IT teams won't allow Chrome Frame, or other modern browsers).

node-webkit sounds most promising.
From the README on the github repository:
node-webkit is an app runtime based on Chromium and node.js. You can
write native apps in HTML and Javascript with node-webkit. It also
lets you to call Node.js modules directly from DOM and enables a new
way of writing native applications with all Web technologies.
If LightTable can be built with it, certainly a web application can be ported and run natively using it.

I know this is a bit late, but what about Sencha Desktop Packager?
http://www.sencha.com/products/desktop-packager
It was primarily developed for ExtJS apps, but it should work on any JavaScript app.
We had a similar requirement and ended up building a dedicated web browser using QT. However if we'd known about the Sencha Desktop Packager before we may have gone for that.

Related

Make automated browser scripts into node.js

I make these browser scripts in JavaScript and use them in tamper monkey or the console. I make these scripts for various tasks like automating different functions on websites that are not mine. I was wondering if there is a way to use these scripts without the browser but as a desktop application. I have heard about node.js and hopefully I can use it for what I want. I'm not really familiar with node.js but use applications made by node.
Thanks!
nodejs isn't really what you are looking for even though what you are looking to do can be accomplished using libraries written for nodejs. Look into PhantomJS and Selenium (webdriver.io)
Currently speaking you can't do that with desktop applications made with Native APIs like .NET Windows Applications or Cocoa OSX applications, because what you're doing with TamperMonkey is manipulating the Webpage(DOM) which is usually not accessible, when it is there in desktop applications.
The only desktop apps you might be able to do that on, are Electron apps since they're using the DOM, if you have access to the dev tools in the app you can run JavaScript just like in Chrome dev tools.
Look into AutoHotkey for automating keystrokes and mouse clicks if you're on Windows, see if it might help you automate according to your needs.

Electron UI for Golang Program?

I'd like to make a GUI in Electron for a Desktop Application written in Go (currently it's a command line tool).
What's the convention for communicating between the Electron and Go processes?
Would simply using the Go binary as an API work? Some sort of websocket communication?
You can use go-astilectron it allows you to build cross-platform GUI apps with GO and HTML/JS/CSS (powered by Electron) (disclosure: I'm the author)
The interaction of an application written in electron with its backend is exactly like a Web browser, therefore you have the same options (Web Api, Web Sockets, Ajax, etc.)
You can execute your command line app from your Electron app via child_process.spawn and communicate with it via stdin/stdout.
Murlock
Is an Electron wrapper for Golang to make it easy for this kind of app for Mac. They're working on Windows and looking for contributions for the other platforms.
Similarly to Murlock, may I dare to suggest Webview library. It's a thin wrapper over Webkit and MSHTML that runs on Windows 7+, MacOS, Linux and OpenBSD.
It is much smaller and easier than Electron. Also the resulting apps are smaller and less memory-hungry.
You may have a look at https://github.com/zserge/webview/tree/master/examples/todo-go for a Todo app example that compiles into a small standalone binary.
I've been looking exactly on how to run ElectronJS backend with Go to build a native desktop application.
you can use extraResources with process.resourcesPath variable to get into the Resources folder. and execute your binary. its not very recommended though.
Other option to use: https://github.com/wailsapp/wails
Its very lightweight and can export your app to MacOS and Windows.
Checkout muon which is best described by their readme:
Muon is a lightweight alternative to Electron written in Golang in about ~300 LoC, using Ultralight instead of Chromium. Ultralight is a cross-platform WebKit rewrite using the GPU to target embedded desktop applications that resulted in a fast, lightweight, and low-memory HTML UI solution that blends the power of Chromium with the small footprint of Native UI.
I have not used it myself but it looks very promising!

Distribute Single Page Application as native desktop software

Is it possible to pack s single page application (its JavaScript files and images and all the assets) so that it can be distributed as a native
desktop application? Like having an instance of Chrome without any button that just runs your application offline.
I've used software that seems to be crafted like that, for example TweetDeck by Twitter gives me the impression of being just the web-version of TweetDeck packed in some way to run in a context that is not your standard browser.
You can use NW.js (previously Node WebKit) or Electron to do just that.
There's NW.js.
To package nodejs / html apps on the desktop.
You can do it by implementing a headless browser application.
There is an open source web browser engine here https://www.webkit.org/.
You incorporate it in a native application and parse the source files.
The webkit documentation presumably contains the specifics, have fun :)
Very much possible and all HTML5 apps are doing that, all your need is this:
https://cordova.apache.org/

Can a web application be converted to a google chrome application?

We have a very simple digital signage application that loads six web pages and rotates through them in an iframe.
We thought we would like to take this application and run in kiosk mode as a chromium app. However, simply using the HTML in the page has thrown all kinds of errors for the app. The most consistent on is the illegal use of external images, css, and fonts as well as complaints about javascript libraries, etc.
It looks as though it will be extremely painful to try to make this into a kiosk app.
Is it possible to make this type of conversion?
Does anyone have advice as to how to proceed?
Can you pull in external pages into a Chromium app?
You cannot run Javascript on a browser via local filesystem for security reasons. But what you could do is package the web app as a local app.
One option is to use Windows HTML Application (HTA)
http://en.wikipedia.org/wiki/HTML_Application
But this requires Internet Explorer to run.
Another option that sounds great is using Node Webkit. I have never done it before, but seems very powerful.
https://www.npmjs.com/package/nodewebkit
You can write a powerful Javascript app and run it locally this way.
UPDATE
Official Node Webkit website:
http://nwjs.io/

Desktop application development with Javascript and HTML

I am looking for Titanium Appcelerator alternatives for Desktop application development with HTML and JavaScript. I want to convert a web app to a desktop application. Hence, there will be a lot of server interaction. Appcelerator was a good choice, but it looks like the company is no longer interested in the Desktop SDK. Also, ajax request from Appcelerator does not retain cookies.
I read that Adobe Air can be used for desktop app development, but I don't want to use flash.
How good is XULRunner? Will it allow features like Growl notificaiton and creating tray icons?
Will I be able to develop applications using mostly Javascript and HTML in Qt?
I started looking into Titanium for desktop dev. I liked the concept but not the implementation. I then stumbled upon chromiumembedded and have been mostly very happy with it. It's basically a web browser control based on chromium.
http://code.google.com/p/chromiumembedded/
It's written in C++ so you can do all the low level OS stuff you want(Growl, tray icons, local file access, com ports, etc) in your container app, and then all the application logic and gui in html/javascript. It allows you to intercept any http request to either serve local resources or perform some custom action. For example, a request to http://localapp.com/SetTrayIconState?state=active could be intercepted by the container and then call the C++ function to update the tray icon.
It also allows you to create functions that can be called directly from javascript.
My biggest challenge has been debuging. It's very difficult to debug javascript directly in CEF. There's no support for anything like Firebug that I am aware of.
Appjs (appjs.org) looks very promising.
You could also check Bowline which is another alternative: http://bowlineapp.com/.
Although it's not officially intended for general-purpose use, a number of people have had success using brackets-shell for HTML/JS desktop apps. It embeds Chromium (CEF) and adds APIs for menu bar management and file IO. It also embeds an instance of Node.js so you get access to all its APIs for launching processes, etc. It's MIT-licensed and available for Mac & Win, with a Linux version currently making rapid progress.
As I mentioned, it's not officially a general-purpose app shell, but someone wrote a detailed blog post about how to customize brackets-shell for your own uses.
I notice that the other answer about Titanum says CEF is hard to debug. I'm not sure if that's true in Titanium, but in brackets-shell it's easy to debug JS – you just open http://localhost:9234/ to load a full instance of the Chrome Developer Tools (including breakpoints, profiling, etc.).
TideSDK is a continuation of the old Titanium desktop http://www.tidesdk.org/

Categories

Resources