1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
4 Copyright 2007, Google Inc.
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11 2. Redistributions in binary form must reproduce the above copyright notice,
12 this list of conditions and the following disclaimer in the documentation
13 and/or other materials provided with the distribution.
14 3. Neither the name of Google Inc. nor the names of its contributors may be
15 used to endorse or promote products derived from this software without
16 specific prior written permission.
18 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
21 EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 <title>Desktop API
</title>
33 <link rel=
"stylesheet" type=
"text/css" href=
"gears.css" />
40 <div id=
"pagecontent">
42 <p>The Desktop module provides an interface for accessing desktop related
43 functionality, such as creating shortcuts.
45 <h2 id=
"example">Example
</h2>
47 <pre><code><script
type=
"text/javascript" src=
"<a href=
48 'tools.html#gears_init'>gears_init.js</a>"></script
>
49 <script
type=
"text/javascript">
50 var desktop = google.gears.factory.create('beta.desktop');
51 desktop.createShortcut(
"Test Application",
52 "An application at http://example.com/index.html",
53 "http://example.com/index.html",
54 {
"128x128":
"http://example.com/icon128x128.png",
55 "48x48":
"http://example.com/icon48x48.png",
56 "32x32":
"http://example.com/icon32x32.png",
57 "16x16":
"http://example.com/icon16x16.png"});
58 </script
></code></pre>
61 <h2 id=
"classes">Classes
</h2>
63 <pre><code><a href=
"#Desktop">Desktop class
</a>
64 bool
<b>createShortcut
</b>(name, description, url, icons)
70 <a name=
"Desktop"></a>
71 <h2>Desktop class
</h2>
77 <th colspan=
"2"><code>createShortcut(name, description, url, icons)
</code></th>
80 <td width=
"113">Summary:
</td>
81 <td width=
"550" class=
"odd">
82 Creates a desktop shortcut for launching a web application.
88 <code>name
</code> - The user-visible name of the shortcut. It cannot contain any of these characters:
89 <code>"\/:*?<>|</code>
91 <code>description</code> - Additional text to display in the
94 <code>url</code> - The address to launch when the user opens the shortcut.
96 <code>icons</code> - An object containing one or more of these named
97 properties: <code>128x128</code>, <code>48x48</code>,
98 <code>32x32</code>, <code>16x16</code>. The value of each property must
99 be the URL of a .png file, with dimensions matching the property name.
105 The icon sizes were chosen to meet the needs of a variety of platforms.
106 If an application wants its icons to look as good as possible on all
107 platforms, it should provide all valid sizes.
109 Only one desktop shortcut can exist for any particular name.
111 The shortcut will launch the same web browser that created the shortcut.
113 The <code>url</code> and <code>icons</code> values can be relative or
114 absolute URLs. Relative URLs are resolved using the caller's location.
116 Calling this API will trigger a confirmation dialog. The dialog will
117 use the 32x32 icon if it exists, or else the closest size available.