-
Notifications
You must be signed in to change notification settings - Fork 24
/
mozilla-app.html
47 lines (39 loc) · 1.62 KB
/
mozilla-app.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<html manifest="cron.appcache">
<head>
<title>Install Cron</title>
</head>
<body>
<script type="text/javascript">
//expands on the previous example code
function installCallback(result) {
document.write('See your <a href="https://myapps.mozillalabs.com/">Apps</a>');
// window.location.href="https://myapps.mozillalabs.com/";
// great - display a message, or redirect to a launch page
}
function errorCallback(result) {
alert(result.message);
// whoops - result.code and result.message have details
}
function installCheck(data) {
if (data) {
// yes, we're installed
// data.manifest has the manifest
// data.install_time is when it was installed
// data.install_origin is the domain that called install
// data.install_data has the optional data from install
window.location.href="https://myapps.mozillalabs.com/";
} else {
// not installed!
navigator.mozApps.install(
"http://cron.cruel-online.de/cron.webapp",
{},
installCallback,
errorCallback
);
}
}
navigator.mozApps.amInstalled(installCheck);
</script>
</body>
</html>