Update check

This commit is contained in:
Mahdi Dibaiee 2014-02-09 19:41:39 +03:30
parent 485f9077f5
commit a8961dee86
3 changed files with 13 additions and 2 deletions

5
Web/cache.appcache Normal file
View File

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

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html manifest='cache.appcache'>
<head>
<title>Sketchy</title>

View File

@ -92,7 +92,13 @@ $(document).ready(function() {
var request = navigator.mozApps.checkInstalled('mdibaiee.github.io/Sketchy/Web/manifest-web.webapp');
request.onsuccess = function() {
if( !this.result && confirm('A new version is available, do you want to update?') ) {
navigator.mozApps.install('mdibaiee.github.io/Sketchy/Web/manifest-web.webapp');
var ins = navigator.mozApps.install('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')
}
}
}
request.onerror = function() {