Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use absolute URL for install, except in example page

  • Loading branch information...
commit 7e62c1349bd564180b42519740863d1b7d80a890 1 parent a041c72
Ian Bicking authored

Showing 2 changed files with 89 additions and 2 deletions. Show diff stats Hide diff stats

  1. +3 2 index.html
  2. +86 0 relativeurl.html
5 index.html
@@ -15,7 +15,7 @@
15 15 }
16 16 pre {
17 17 border: 1px solid #999;
18   - overflow: auto;
  18 + overflow: wrap;
19 19 width: 100%;
20 20 }
21 21 </style>
@@ -44,7 +44,8 @@
44 44 setInstalled();
45 45
46 46 $('#install').click(function () {
47   - var pending = navigator.mozApps.install('/manifest.webapp');
  47 + var pending = navigator.mozApps.install(location.protocol + '//'
  48 + + location.host + '/manifest.webapp');
48 49 pending.onsuccess = function () {
49 50 setInstalled();
50 51 };
86 relativeurl.html
... ... @@ -0,0 +1,86 @@
  1 +<html>
  2 + <head>
  3 + <title>app1</title>
  4 + <script src="https://myapps.mozillalabs.com/jsapi/include.js"></script>
  5 + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  6 + <style>
  7 + .status {
  8 + border: 2px solid #000;
  9 + background-color: #ddd;
  10 + display: inline;
  11 + padding: 4px;
  12 + }
  13 + div {
  14 + margin-bottom: 1em;
  15 + }
  16 + pre {
  17 + border: 1px solid #999;
  18 + overflow: wrap;
  19 + width: 100%;
  20 + }
  21 + </style>
  22 + <script>
  23 +$(function () {
  24 + function setInstalled() {
  25 + var pending = navigator.mozApps.getSelf();
  26 + pending.onsuccess = function () {
  27 + if (this.result) {
  28 + $('#unknown').hide();
  29 + $('#uninstalled').hide();
  30 + $('#installed').show();
  31 + $('#record').text(JSON.stringify(this.result, null, true));
  32 + } else {
  33 + $('#unknown').hide();
  34 + $('#installed').hide();
  35 + $('#uninstalled').show();
  36 + $('#record').text('');
  37 + }
  38 + };
  39 + pending.onerror = function () {
  40 + alert('Error in getSelf: ' + (this.error.name || this.error));
  41 + };
  42 + }
  43 +
  44 + setInstalled();
  45 +
  46 + $('#install').click(function () {
  47 + var pending = navigator.mozApps.install('/manifest.webapp');
  48 + pending.onsuccess = function () {
  49 + setInstalled();
  50 + };
  51 + pending.onerror = function () {
  52 + if (this.error == 'DENIED' || this.error.name == 'DENIED') {
  53 + return;
  54 + }
  55 + alert('Error in install: ' + (this.error.name || this.error));
  56 + };
  57 + });
  58 +});
  59 +
  60 + </script>
  61 +
  62 + </head>
  63 + <body>
  64 + <div>
  65 + Welcome to <code>app1</code>
  66 + </div>
  67 +
  68 + <div>The manifest is located at <a
  69 + href="http://app1.ianbicking.org/manifest.webapp">http://app1.ianbicking.org/manifest.webapp</a>
  70 + </div>
  71 +
  72 + <div>Installation status is:
  73 +
  74 + <div id="unknown" class="status">Unknown</div>
  75 + <div id="installed" class="status" style="display: none">Installed</div>
  76 + <div id="uninstalled" class="status" style="display: none">Uninstalled</div>
  77 +
  78 + </div>
  79 +
  80 + <div>To install or reinstall:
  81 + <button type="button" id="install">Install</button>
  82 + </div>
  83 +
  84 + <pre id="record"></pre>
  85 +
  86 +</body>

0 comments on commit 7e62c13

Please sign in to comment.
Something went wrong with that request. Please try again.