Update check

This commit is contained in:
Mahdi Dibaiee 2014-02-09 19:52:38 +03:30
parent a8961dee86
commit 8c10812a91
2 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,5 @@
CACHE MANIFEST
index.html
js/
css/
js
css

View File

@ -89,9 +89,10 @@ $(document).ready(function() {
// Check for Update
var request = navigator.mozApps.checkInstalled('mdibaiee.github.io/Sketchy/Web/manifest-web.webapp');
var request = navigator.mozApps.getInstalled();
request.onsuccess = function() {
if( !this.result && confirm('A new version is available, do you want to update?') ) {
var app = this.result[0];
if( !app && confirm('A new version is available, do you want to update?') ) {
var ins = navigator.mozApps.install('mdibaiee.github.io/Sketchy/Web/manifest-web.webapp');
ins.onsuccess = function() {
alert('The app was installed successfuly');