Update check
This commit is contained in:
parent
ef8ddaf380
commit
483f681400
@ -93,20 +93,25 @@ $(document).ready(function() {
|
||||
request.onsuccess = function() {
|
||||
var app = this.result[0];
|
||||
var latest = $.ajax({url:'manifest-web.webapp'});
|
||||
latest.onload = function() {
|
||||
if( this.response ) {
|
||||
var lapp = JSON.parse(this.response);
|
||||
alert(lapp.version);
|
||||
alert(app.manifest.version);
|
||||
if( lapp.version != app.manifest.version &&
|
||||
confirm('A new version of this app is available, do you want to update? ' + app.manifest.version + ' to ' + lapp.version )) {
|
||||
var ins = navigator.mozApps.install('http://mdibaiee.github.io/Sketchy/Web/manifest-web.webapp');
|
||||
ins.onsuccess = function() {
|
||||
alert('The app was installed successfuly');
|
||||
}
|
||||
ins.onerror = function() {
|
||||
alert('There was an error installing app')
|
||||
console.log(this.error);
|
||||
var selfApp = navigator.mozApps.getSelf();
|
||||
selfApp.onsuccess = function() {
|
||||
if(this.result) {
|
||||
latest.onload = function() {
|
||||
if( this.response ) {
|
||||
var lapp = JSON.parse(this.response);
|
||||
alert(lapp.version);
|
||||
alert(app.manifest.version);
|
||||
if( lapp.version != app.manifest.version &&
|
||||
confirm('A new version of this app is available, do you want to update? ' + app.manifest.version + ' to ' + lapp.version )) {
|
||||
var ins = navigator.mozApps.install('http://mdibaiee.github.io/Sketchy/Web/manifest-web.webapp');
|
||||
ins.onsuccess = function() {
|
||||
alert('The app was installed successfuly');
|
||||
}
|
||||
ins.onerror = function() {
|
||||
alert('There was an error installing app')
|
||||
console.log(this.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user