• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html>
2<!--
3 * Copyright (c) 2009 The Chromium Authors. All rights reserved.  Use of this
4 * source code is governed by a BSD-style license that can be found in the
5 * LICENSE file.
6-->
7<html>
8  <head>
9    <title> Simple Background App </title>
10    <style>
11      .hidden { display: none; }
12      #unsupported { color: #d00; }
13    </style>
14  </head>
15  <body>
16    <h1> Simple Background App </h1>
17    <p id="supported" class="hidden">
18      <button onclick="openBackgroundWindow()">Open background window</button>
19      <button onclick="closeBackgroundWindow()">Close background window</button>
20    </p>
21    <p id="unsupported" class="hidden">
22      You are not using Chrome or have not installed the application for this
23      page.
24    </p>
25    <script>
26      // Check for support
27      if (window.chrome && window.chrome.app && window.chrome.app.isInstalled) {
28        document.getElementById('supported').className = '';
29      } else {
30        document.getElementById('unsupported').className = '';
31      }
32      var bgWinUrl = "background.html#yay";
33      var bgWinName = "bgNotifier";
34
35      function openBackgroundWindow() {
36        window.open(bgWinUrl, bgWinName, "background");
37      }
38      function closeBackgroundWindow() {
39        var w = window.open(bgWinUrl, bgWinName, "background");
40        w.close();
41      }
42    </script>
43    <p>
44      This app displays a notification
45      whenever its background window is created.
46      Background windows and this app are described in the
47      <a href="http://code.google.com/chrome/apps/docs/developers_guide.html">apps documentation</a>.
48    </p>
49    <p>
50      The generic source code is available for
51      <a href="http://code.google.com/chrome/extensions/trunk/examples/apps/background-simple.zip">download</a>.
52      The
53      <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>
54      tells you how to modify the code.
55    </p>
56    <p>
57      If you just want to run a version of this app that's already on the web,
58      here's how:
59    </p>
60    <ol>
61      <li>
62        <a href="http://background-simple.appspot.com/app.crx">Install the app</a>
63        from background-simple.appspot.com.
64      </li>
65      <li>
66        Launch Simple Background App from the New Tab page.
67      </li>
68    </ol>
69  </body>
70</html>
71