Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Flash_L_
Beginner
30 Views

Difference between HTML5+Cordova project and Standard HTML5 project

In XDK, we are forced to choose between creating a HTML5+Cordova project and Standard HTML5 project.

I have not been able to find a discussion on the differences between them.

Some people believes that a Standard HTML5 project means that it will be hosted on remote web server like a Single Page App (SPA). LIke a bunch of static HTML, JS, CSS files for web server.

My personal guess is they differ in the output format after a build? For Cordova projects, they can be built into Android .apk and iOS .ipa format? While Standard HTML5 project would build into a ZIP archive for uploading to web server?

More specifically, what will a developer lose out when he chooses the Standard HTML5 project, without Cordova. Certainly Cordova plugins will not be available but HTML5 capabilities in geo-location, WebSocket, WebRTC, camera, video, audio, and storage handling can handle many of the basic tasks. Perhaps without accelerometer.

The main difference could be in the API. For example to take a photo:

Cordova

navigator.camera.getPicture(onSuccess, onFail, {
    quality: 50,
    destinationType: Camera.DestinationType.DATA_URL
});

HTML5

navigator.webkitGetUserMedia('video, audio', onSuccess, onError);

function onSuccess(stream) {
    var output = document.getElementById('output'); //a <VIDEO> element
 
    output.autoplay = true; //you can set this in your markup as well
 
    output.src = is_webkit ? window.webkitURL.createObjectURL(stream) : stream;
}

function takepicture(videoOutput, width, height) {
      var canvas = document.getElementById('canvas'),
          photo  = document.querySelector('photo');
                       
    canvas.width  = width;
    canvas.height = height;
    canvas.getContext('2d').drawImage(videoOutput, 0, 0, width, height);
    var data = canvas.toDataURL('image/png');
    photo.setAttribute('src', data);
}

Hope experienced XDK users and Intel can address this.

Tags (2)
0 Kudos
1 Reply
PaulF_IntelCorp
Employee
30 Views

If you want to distribute your app through a store it needs to be packages as an APK (for Android), IPA (for iOS), etc. In that case the app is running inside the native "webview" on the device or, in the case of Android, the Crosswalk webview (if you choose to "optimize with Crosswalk"). You are NOT running inside the mobile browser, so many of the features you describe having access to in the browser may not be available in the webview, depending on the version of the OS on the device, the manufacturer, etc. See this blog for some additional background > https://blogs.intel.com/evangelists/2014/09/02/html5-web-app-webview-app/ <

When you build a "standard HTML5" app with the XDK, for Android, iOS or Windows, you are, in fact, building a Cordova app, without any Cordova plugins. Your app is running in the target webview, it is not running on the mobile browser.

Reply