What js 'engine' does cordova use? - javascript

What JS 'engine' does Cordova use? Is it platform specific or is it one standard across all platforms? Meaning safari for iOS and chrome for Android, and possible IE standards for windows? Or a 'Cordova JS' engine across all platforms.
More specifically i read that it depends on the browser JS implementation for what sorting algorithm .sort() uses (Mozilla uses merge-sort). And i was considering using a merge-sort function i created or the standard .sort() function. (which could be a merge-sort anyway). The built in .sort() seems to be about 10ms quicker, or about 14% quicker.
Only reason I would want to use my merge-sort (slower) is because I know for sure it will be implemented exactly the same across iOS, windows, android, etc...

On Android it uses Android WebView which is based on Chromium, and uses the V8 JavaScript engine.
On iOS, as of iOS8 it uses the WKWebView which is based on Safari and uses the Nitro JavaScript engine.
On other platforms... well, whatever the native web view is.

Cordova is, at the end of the day, a native app with a web view embedded inside, and it uses the web browser component specific to the platform where the app is deployed.
If you wish to use another Web browser component is still possible. Take a look at Crosswalk.

Related

Does GeckoView for Android provide a Javascript interface/callback?

Since the WebView implementation on Android depends on the Android version and the manufacturer (Samsung and other manufacturers apply their own patches to it), I'd like to provide my own rendering engine for my Android app to reduce QA overhead and gain more confidence.
I tinkered around with both the Chrome engine (Chromium) and the Firefox engine (GeckoView) and integrated them into my Android app.
The GeckoView is very straight forward to integrate and so far it is working well. The only thing I am missing is a Javascript interface (bi-directional) similar to WebView's addJavascriptInterface.
Is there any way to get Javascript callbacks and to execute Javascript with GeckoView?

webview for user interface in android

I was searching for how to use swf file in android and most of the answer suggested me to use webview and an simple html file.
Now i think We can easily put css and javascript files in asset folder and then we can use them in an html5 code.
Looking at the power of HTML5, This will make app development for a web designer very easy job !
I just want to know that is it good to use this approach to build a good user interface in android ? Are there any technical pros/cons behind it ? will i miss some features provided by android ?
There are a lot of frameworks that allow you to write native android applications using HTML/CSS/JavaScript only. Here some of them :
PhoneGap
Cordova
Titanium
I've never used any of them, so I can't say if it's good or bad idea to write android apps this way, but here you can find a good session about it HTML5 versus Android.
There are pros & cons of using cross platforms. As per my point of view you shouldn't go for loading of everything in WebView.
I still recommend you native app approach because of following points :
WebView is one of the UI control in Android SDK. So, it will have
limitation of memory size and working with CPU utilization. So, you
might face performance issues in some devices.
As you know in older era we were used to work with desktop apps and after that everything is shifted to web-application.
It was
possible only because our browser(s) gets more features for e.g. more
memory area, CPU access, threading, individual Processing (like
google chrome) etc...
in-short, web browsers gets more smart and get treated as separate application. Now a days web-application can have mostly similar
performance as desktop apps. So, everything is now shifted to
web-application development.
This era will come in to Mobile development in later stage. but currently we are in middle stage of Mobile development and Cross platform development. So until and unless Web-View control of any platform (iOS / Android) gets more powerful, we can not totally relay on that.
I Hope I explain it properly :)

Windows 8 Metro Interface - Is it IE10?

I've started playing with Windows 8 recently, and (as a web developer) I'm using JavaScript to build my Metro-style app.
I've learned how to use the debugging tools in VS Express 2012... but it occurs to me that the wrapping WebView (or whatever it's called) could simply be a stripped-down IE10.
I've never heard an explanation for what the HTML/JS engine is in this environment. Does anyone know what is happening under the hood?
This is correct. The rendering of Windows 8 WinRT apps built with XAML is handled by XAML and the ones being built using JS/HTML/CSS are rendering using an IE10's HTML rendering engine and IE10's JavaScript engine.
This is the main reason why IE10 is the only browser that currently implements CSS3 grid layout.
For debugging information on Windows Store Apps written using JavaScript/HTML/CSS:
There is a runtime DOM inspector provided by VS, there is Expression Blend where you can also run the app and there is the native VS debugger. However there is no tool like the IE10 developer tools. The intellitrace should give you enough networking information needed for debugging.
If you look in the Details tab of your Task Manager while you have a Windows 8 HTML/JS app running, you'll see a process called WWAHost.exe. That process is hosting the Trident (HTML/CSS) and Chakra (JavaScript) engines and running the app. The IE10 browser on your machine uses the same engine. There are a few differences between the way apps behave versus websites, however, and you can see those here.

Solutions for distributing HTML5 applications as desktop applications? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What are some solutions for distributing an HTML5 based desktop application?
I want to be able to distribute my HTML5 app as a standalone desktop application on Windows, OSX, and Linux. I would like for people to be able to double click my app icon shortcut to run my program.
I don't want the browser window showing at all, just my app. Is this possible?
HTML5 Apps in 2014
Frames by chrome/webkit
Electron (former Atom Shell)
Electron is an open source library developed by GitHub for building cross-platform desktop applications with HTML, CSS, and JavaScript. Electron accomplishes this by combining Chromium and Node.js into a single runtime and apps can be packaged for Mac, Windows, and Linux. (source)
The folks at github use this to provide their code editor Atom as an app. It has an documented api and a help channel on the official atom forums.
Node-Webkit, the most minimal approach
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 call Node.js modules directly from the DOM and enables a new way of writing native applications with all Web technologies.
Intel is behind this (?). I've been told it's very rough around the edges.
Brackets Shell, the sandbox of Adobes code editor (and base of Adobe Edge)
Note: The brackets-shell is only maintained for use by the Brackets project. Although some people have definitely had success using it as an app shell for other projects, we don't provide any official support for that and we haven't done a ton of work to make the app shell easily reusable. Many people will likely find it easier to use a project like node-webkit, which is more generic by design.
says the readme, but there are quite a lot of folks out there who did it nevertheless.
Frameworks + Tools
Adobe AIR, as another answers suggested.
The Adobe® AIR® runtime enables developers to package the same code into native apps for Windows and Mac OS desktops as well as iPhone, iPad, Kindle Fire, Nook Tablet, and other Android™ devices, reaching the mobile app stores for over 500 million devices.
Sencha is a company which sells tools for app developers, including html5 app development and distribution.
Inactive approaches
Tide SDK (archived on 2015-07-12 at archive.org), beta version, discontinued on 12th Jul 2015
http://www.tidesdk.org/
XULRunner from Mozilla may do the trick for you but adds some overhead.
app.js ended at 28th Oct 2013 for being surpassed by (https://github.com/rogerwang/node-webkit)[node-webkit].
Because it is simple and yet powerful. Using AppJS you don't need to be worry about coding cross-platform or learning new languages and tools. You are already familiar with HTML, CSS and JavaScript. What is better than this stack for application development? Beside, AppJS uses Chromium at the core so you get latest HTML 5 APIs working. So and focus on the task your application should do.
Mozilla Prism is decomissioned, their slugline was:
Bringing web applications to your Desktop
Prism is an application that lets users split web applications out of their browser and run them directly on their desktop.
You can use AppJS which uses Nodejs and Chromium to build html5 apps for desktop. check it out: http://appjs.com
Github Link: https://github.com/appjs/appjs
Definitely check out Titanium. Just today I took a functional HTML5 app and with a few minor modifications was able to drop it into Titanium and package it up for Mac, Windows and Linux.
And it also supports PHP, Python and Ruby if your app requires "server-side" processing.
You might want to look at XULRunner from Mozilla. At a 10000 foot level, the FireFox browser is a XULRunner application (obviously a very sophisticated one, but...). But XULRunner lets you use Javascript and XML to create applications, and the browser window is one of those components, so you once you get your basic window up, you can likely do pretty much anything you want.
Also, depending on the sophistication of your application, there are several "widget" frameworks (like Dashboard on the Mac, Yahoo Widgets, Windows Gadgets) which are basically HTML runtimes as well.
chrome can do what prism does See -- Tools-> Create application Shortcut
You can try Phonegap, there is a Windows Desktop Port: https://github.com/davejohnson/phonegap-windows
I tried the mac-port, it worked well. I didn't try the windows version yet.
[On Windows only] try HTML Application (HTA) approach - simply save your .html file with .hta extension. It also provides some additonal settings to get rid of browser window, set level of trust for the app, etc. Read more here: http://en.wikipedia.org/wiki/HTML_Application and here http://technet.microsoft.com/en-ca/scriptcenter/dd742317.aspx
Adobe AIR is meant to let you work primarily in HTML, CSS, and JavaScript while providing a desktop application. (Caveat: I haven't actually used it myself.)
Check this new project from Mozilla. You can create desktop apps too : https://developer.mozilla.org/en/Apps
Detail here: http://hacks.mozilla.org/2012/05/desktop-apps-with-html5-and-the-mozilla-web-runtime/
Hmmm... a virtual machine for HTML5/CSS/JS... sounds like a browser. :)
Maybe Adobe AIR would do the trick, because it's based on the idea of bringing rich Internet apps to the desktop. I've never used it, however.
One thing you could do is develop a very basic desktop app that uses some kind of prepackaged web browser control (e.g. if you're developing for a Mac, just drop a WebView in the window and add some basic code to load your html upon app startup).
For mobile phones you can use PhoneGap http://www.phonegap.com/ . Probable with some more coding you can use it for desktop.
Sencha http://www.sencha.com/
Pokki http://www.pokki.com/
Currently the answer is that are different solutions of each platform.
For MAC OSX You will create a Cocoa Desktop App with a UIWebView
For Windows you will make a .NET desktop app with a browser component.
You can use a embedded server like Tomcat or maybe Apache.
I use tomcat for a complete java web application. Run inside browser, but the application need be installed. The shortcut to start the app, start the service and open the browser.
Or try use webkit
A bit late, but you can use a portable version of google chrome, and then create a small windows app to install it, and create a .ink shortcut to its --kiosk and app mode.
Kinda like chrome application shortcuts, but where you install chrome for them.
If you just need it for Windows, you should consider HTML Applications (HTA), it's been part of Internet Explorer since IE 5 (10+ years).
No server required, full HTML formatting, full access to local resources (even COM / USB ports), awesome. Also, easy to debug with Visual Studio, just bind to MSHTA.exe
You can enable HTML 5 in HTA's with the following meta tag:
<!-- enable html5 features -->
<meta http-equiv="X-UA-Compatible" content="IE=edge"></meta>

Building a Windows app w/ embedded browser & JavaScript 'hooks'

I built a PHP / JavaScript website for a customer. Then they asked me to replicate it except as a standalone Mac application. I did this with an app that combined an embedded web server, PHP, and 'WebView' - a Cocoa-ish version of the WebKit web browser that I can embed in a standard app window. This all worked great - I got to reuse 10,000+ lines of PHP/JS code, which saved months off of re-implementing it all again in 'native' code.
Now they want a Windows equivalent. I'm reasonably confident I can get PHP and the web server to work. And I know embedding basic IE functionality is pretty easy.
However...in my Mac setup, WebView (via the windowScriptObject stuff) gave me the ability to call JavaScript methods from C++. For instance, I might call a JavaScript method from C++ to update the screen. Likewise I could set things up so that a JavaScript call in the browser could trigger a C++ method - I used this, for instance, to let a user click 'BROWSE' and pick a file path using a real, standard file browser.
So my question is, is there a Windows-based embedded browser setup that would let me interact with JavaScript in this same way?
(the JavaScript <--> WebKit interface is described in much better detail here: http://lipidity.com/apple/javascript-cocoa-webkit/)
Maybe try using something like Appcelerator Titanium so you'll be ready when your client says they want it to work on Linux, or iPhone, or Android.
Quoting Wikipedia: "Appcelerator Titanium is a platform
for developing mobile and desktop
applications using web technologies.
[...] Support for standards-based web
technologies: HTML, CSS and Javascript
on all platforms along with PHP,
Python and Ruby for desktop platforms.
Integrated support for popular
JavaScript and AJAX Frameworks
including jQuery, YUI, MooTools,
Scriptaculous and others."
Sounds like a perfect tool for the job.
When you embed the Web Browser Control (IE), your application code can simply call execScript (http://msdn.microsoft.com/en-us/library/ms536420(v=vs.85).aspx) on the window object. You can have your script call out to the application by using the window.external object from the script, and by using the ObjectForScripting (or C++ equivalent) from the application.
maybe Qt will be good for your case, also you have QtScript and can inject javascript with evaluateJavaScript
I found a great example on the web for invoking JS in my embedded browser from C...basically using COM-ish methods that let you get a DISPID from a script object, and then using the Invoke() method with that. This works great.
But it turns out I need to also call C++ funcs from my JS code. It appears this is possible, and after hours of messing around I think I almost had it - it's like the above in reverse - you create a COM object, then hook it to the browser's script object - but in the end I could not close the deal - I kept getting "library not registered" errors. Honestly I don't know COM well enough to do this right.
So then I, for the heck of it, tried building my first C# app. In about 20 minutes I had an app running with a browser where I could both invoke JS inside of it and have the browser invoke C# methods. Geesh. I'm a believer in .NET after this experience, and a confirmed non-believer in 90's Microsoft technology.
In the interest of completeness, I'd like to mention my Windows port of WebKit, which includes the various cross-layer features of WebKit on the Mac.
I posted some example code showing how to embed WebKit in a native WinAPI application, complete with JavaScript->C++ and C++->JavaScript examples.
The example is a tiny test case for a much larger application using embedded WebViews for major UI components. I can confirm that what you are doing is not only possible, but a great way to build an application.

Categories