summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/examples/apps/background-simple/index.html
blob: e5da99b70dfacf4128ab7ad73bd517c1a77bfafc (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<!--
 * Copyright (c) 2009 The Chromium Authors. All rights reserved.  Use of this
 * source code is governed by a BSD-style license that can be found in the
 * LICENSE file.
-->
<html>
  <head>
    <title> Simple Background App </title>
    <style>
      .hidden { display: none; }
      #unsupported { color: #d00; }
    </style>
  </head>
  <body>
    <h1> Simple Background App </h1>
    <p id="supported" class="hidden">
      <button onclick="openBackgroundWindow()">Open background window</button>
      <button onclick="closeBackgroundWindow()">Close background window</button>
    </p>
    <p id="unsupported" class="hidden">
      You are not using Chrome or have not installed the application for this
      page.
    </p>
    <script>
      // Check for support
      if (window.chrome && window.chrome.app && window.chrome.app.isInstalled) {
        document.getElementById('supported').className = '';
      } else {
        document.getElementById('unsupported').className = '';
      }
      var bgWinUrl = "background.html#yay";
      var bgWinName = "bgNotifier";

      function openBackgroundWindow() {
        window.open(bgWinUrl, bgWinName, "background");
      }
      function closeBackgroundWindow() {
        var w = window.open(bgWinUrl, bgWinName, "background");
        w.close();
      }
    </script>
    <p>
      This app displays a notification
      whenever its background window is created.
      Background windows and this app are described in the
      <a href="http://code.google.com/chrome/apps/docs/developers_guide.html">apps documentation</a>.
    </p>
    <p>
      The generic source code is available for
      <a href="http://code.google.com/chrome/extensions/trunk/examples/apps/background-simple.zip">download</a>.
      The
      <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/apps/background-simple/README?content-type=text/plain">README</a>
      tells you how to modify the code.
    </p>
    <p>
      If you just want to run a version of this app that's already on the web,
      here's how:
    </p>
    <ol>
      <li>
        <a href="http://background-simple.appspot.com/app.crx">Install the app</a>
        from background-simple.appspot.com.
      </li>
      <li>
        Launch Simple Background App from the New Tab page.
      </li>
    </ol>
  </body>
</html>