OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: |
2 <!-- This page is a placeholder for generated extensions api doc. Note: | |
3 1) The <head> information in this page is significant, should be uniform | 2 1) The <head> information in this page is significant, should be uniform |
4 across api docs and should be edited only with knowledge of the | 3 across api docs and should be edited only with knowledge of the |
5 templating mechanism. | 4 templating mechanism. |
6 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a | 5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a |
7 browser, it will be re-generated from the template, json schema and | 6 browser, it will be re-generated from the template, json schema and |
8 authored overview content. | 7 authored overview content. |
9 4) The <body>.innerHTML is also generated by an offline step so that this | 8 4) The <body>.innerHTML is also generated by an offline step so that this |
10 page may easily be indexed by search engines. | 9 page may easily be indexed by search engines. |
11 --> | 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> |
12 <html xmlns="http://www.w3.org/1999/xhtml"> | 11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
13 <head> | |
14 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
15 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css"> | 12 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css"> |
16 <link href="css/print.css" rel="stylesheet" type="text/css" media="print"> | 13 <link href="css/print.css" rel="stylesheet" type="text/css" media="print"> |
17 <script type="text/javascript" | 14 <script type="text/javascript" src="../../../third_party/jstemplate/jstempla
te_compiled.js"> |
18 src="../../../third_party/jstemplate/jstemplate_compiled.js"> | |
19 </script> | 15 </script> |
20 <script type="text/javascript" | 16 <script type="text/javascript" src="../../../../third_party/json_minify/mini
fy-sans-regexp.js"> |
21 src="../../../../third_party/json_minify/minify-sans-regexp.js"> | |
22 </script> | 17 </script> |
23 <script type="text/javascript" src="js/api_page_generator.js"></script> | 18 <script type="text/javascript" src="js/api_page_generator.js"></script> |
24 <script type="text/javascript" src="js/bootstrap.js"></script> | 19 <script type="text/javascript" src="js/bootstrap.js"></script> |
25 <script type="text/javascript" src="js/sidebar.js"></script> | 20 <script type="text/javascript" src="js/sidebar.js"></script> |
26 </head> | 21 <title>Autoupdating - Google Chrome Extensions - Google Code</title></head> |
27 <body> | 22 <body> <div id="devModeWarning" class="displayModeWarning"> |
28 </body> | 23 You are viewing extension docs in chrome via the 'file:' scheme: are you exp
ecting to see local changes when you refresh? You'll need run chrome with --allo
w-file-access-from-files. |
29 </html> | 24 </div> |
| 25 <div id="branchWarning" class="displayModeWarning"> |
| 26 <span>WARNING: This is the <span id="branchName">BETA</span> documentation. |
| 27 It may not work with the stable release of Chrome.</span> |
| 28 <select id="branchChooser"> |
| 29 <option>Choose a different version... |
| 30 </option><option value="">Stable |
| 31 </option><option value="beta">Beta |
| 32 </option><option value="dev">Dev |
| 33 </option><option value="trunk">Trunk |
| 34 </option></select> |
| 35 </div> |
| 36 <div id="unofficialWarning" class="displayModeWarning"> |
| 37 <span>WARNING: This is unofficial documentation. It may not work with the |
| 38 current release of Chrome.</span> |
| 39 <button id="goToOfficialDocs">Go to the official docs</button> |
| 40 </div> |
| 41 <div id="gc-container" class="labs"> |
| 42 <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION --> |
| 43 <!-- In particular, sub-templates that recurse, must be used by allowing |
| 44 jstemplate to make a copy of the template in this section which |
| 45 are not operated on by way of the jsskip="true" --> |
| 46 <!-- /SUBTEMPLATES --> |
| 47 <a id="top"></a> |
| 48 <div id="skipto"> |
| 49 <a href="#gc-pagecontent">Skip to page content</a> |
| 50 <a href="#gc-toc">Skip to main navigation</a> |
| 51 </div> |
| 52 <!-- API HEADER --> |
| 53 <table id="header" width="100%" cellspacing="0" border="0"> |
| 54 <tbody><tr> |
| 55 <td valign="middle"><a href="http://code.google.com/"><img src="images/c
ode_labs_logo.gif" height="43" width="161" alt="Google Code Labs" style="border:
0; margin:0;"></a></td> |
| 56 <td valign="middle" width="100%" style="padding-left:0.6em;"> |
| 57 <form action="http://www.google.com/cse" id="cse" style="margin-top:0.
5em"> |
| 58 <div id="gsc-search-box"> |
| 59 <input type="hidden" name="cx" value="002967670403910741006:61_cvz
fqtno"> |
| 60 <input type="hidden" name="ie" value="UTF-8"> |
| 61 <input type="text" name="q" value="" size="55"> |
| 62 <input class="gsc-search-button" type="submit" name="sa" value="Se
arch"> |
| 63 <br> |
| 64 <span class="greytext">e.g. "page action" or "tabs"</span> |
| 65 </div> |
| 66 </form> |
| 67 <script type="text/javascript" src="https://www.google.com/jsapi"></sc
ript> |
| 68 <script type="text/javascript">google.load("elements", "1", {packages:
"transliteration"});</script> |
| 69 <script type="text/javascript" src="https://www.google.com/coop/cse/t1
3n?form=cse&t13n_langs=en"></script> |
| 70 <script type="text/javascript" src="https://www.google.com/coop/cse/br
and?form=cse&lang=en"></script> |
| 71 </td> |
| 72 </tr> |
| 73 </tbody></table> |
| 74 <div id="codesiteContent" class=""> |
| 75 <a id="gc-topnav-anchor"></a> |
| 76 <div id="gc-topnav"> |
| 77 <h1>Google Chrome Extensions (<a href="http://code.google.com/labs/">Lab
s</a>)</h1> |
| 78 <ul id="home" class="gc-topnav-tabs"> |
| 79 <li id="home_link"> |
| 80 <a href="index.html" title="Google Chrome Extensions home page">Home
</a> |
| 81 </li> |
| 82 <li id="docs_link"> |
| 83 <a href="docs.html" title="Official Google Chrome Extensions documen
tation">Docs</a> |
| 84 </li> |
| 85 <li id="faq_link"> |
| 86 <a href="faq.html" title="Answers to frequently asked questions abou
t Google Chrome Extensions">FAQ</a> |
| 87 </li> |
| 88 <li id="samples_link"> |
| 89 <a href="samples.html" title="Sample extensions (with source code)">
Samples</a> |
| 90 </li> |
| 91 <li id="group_link"> |
| 92 <a href="http://groups.google.com/a/chromium.org/group/chromium-exte
nsions" title="Google Chrome Extensions developer forum">Group</a> |
| 93 </li> |
| 94 <li id="so_link"> |
| 95 <a href="http://stackoverflow.com/questions/tagged/google-chrome-ext
ension" title="[google-chrome-extension] tag on Stack Overflow">Questions?</a> |
| 96 </li> |
| 97 </ul> |
| 98 </div> <!-- end gc-topnav --> |
| 99 <div class="g-section g-tpl-170"> |
| 100 <!-- SIDENAV --> |
| 101 <div class="g-unit g-first" id="gc-toc"> |
| 102 <ul> |
| 103 <li><a href="getstarted.html">Getting Started</a></li> |
| 104 <li><a href="overview.html">Overview</a></li> |
| 105 <li><a href="whats_new.html">What's New?</a></li> |
| 106 <li><h2><a href="devguide.html">Developer's Guide</a></h2> |
| 107 <ul> |
| 108 <li>Browser UI |
| 109 <ul> |
| 110 <li><a href="browserAction.html">Browser Actions</a></li> |
| 111 <li><a href="contextMenus.html">Context Menus</a></li> |
| 112 <li><a href="notifications.html">Desktop Notifications</a></li
> |
| 113 <li><a href="omnibox.html">Omnibox</a></li> |
| 114 <li><a href="options.html">Options Pages</a></li> |
| 115 <li><a href="override.html">Override Pages</a></li> |
| 116 <li><a href="pageAction.html">Page Actions</a></li> |
| 117 </ul> |
| 118 </li> |
| 119 <li>Browser Interaction |
| 120 <ul> |
| 121 <li><a href="bookmarks.html">Bookmarks</a></li> |
| 122 <li><a href="cookies.html">Cookies</a></li> |
| 123 <li><a href="devtools.html">Developer Tools</a></li> |
| 124 <li><a href="events.html">Events</a></li> |
| 125 <li><a href="history.html">History</a></li> |
| 126 <li><a href="management.html">Management</a></li> |
| 127 <li><a href="tabs.html">Tabs</a></li> |
| 128 <li><a href="windows.html">Windows</a></li> |
| 129 </ul> |
| 130 </li> |
| 131 <li>Implementation |
| 132 <ul> |
| 133 <li><a href="a11y.html">Accessibility</a></li> |
| 134 <li><a href="background_pages.html">Background Pages</a></li> |
| 135 <li><a href="content_scripts.html">Content Scripts</a></li> |
| 136 <li><a href="xhr.html">Cross-Origin XHR</a></li> |
| 137 <li><a href="i18n.html">Internationalization</a></li> |
| 138 <li><a href="messaging.html">Message Passing</a></li> |
| 139 <li><a href="permissions.html">Optional Permissions</a></li> |
| 140 <li><a href="npapi.html">NPAPI Plugins</a></li> |
| 141 </ul> |
| 142 </li> |
| 143 <li>Finishing |
| 144 <ul> |
| 145 <li><a href="hosting.html">Hosting</a></li> |
| 146 <li><a href="external_extensions.html">Other Deployment Option
s</a></li> |
| 147 </ul> |
| 148 </li> |
| 149 </ul> |
| 150 </li> |
| 151 <li><h2><a href="apps.html">Packaged Apps</a></h2></li> |
| 152 <li><h2><a href="tutorials.html">Tutorials</a></h2> |
| 153 <ul> |
| 154 <li><a href="tut_debugging.html">Debugging</a></li> |
| 155 <li><a href="tut_analytics.html">Google Analytics</a></li> |
| 156 <li><a href="tut_oauth.html">OAuth</a></li> |
| 157 </ul> |
| 158 </li> |
| 159 <li><h2>Reference</h2> |
| 160 <ul> |
| 161 <li>Formats |
| 162 <ul> |
| 163 <li><a href="manifest.html">Manifest Files</a></li> |
| 164 <li><a href="match_patterns.html">Match Patterns</a></li> |
| 165 </ul> |
| 166 </li> |
| 167 <li><a href="permission_warnings.html">Permission Warnings</a></li
> |
| 168 <li><a href="api_index.html">chrome.* APIs</a></li> |
| 169 <li><a href="api_other.html">Other APIs</a></li> |
| 170 </ul> |
| 171 </li> |
| 172 <li><h2><a href="samples.html">Samples</a></h2></li> |
| 173 <div class="line"> </div> |
| 174 <li><h2>More</h2> |
| 175 <ul> |
| 176 <li><a href="http://code.google.com/chrome/webstore/docs/index.htm
l">Chrome Web Store</a></li> |
| 177 <li><a href="http://code.google.com/chrome/apps/docs/developers_gu
ide.html">Hosted Apps</a></li> |
| 178 <li><a href="themes.html">Themes</a></li> |
| 179 </ul> |
| 180 </li> |
| 181 </ul> |
| 182 </div> |
| 183 <script> |
| 184 initToggles(); |
| 185 </script> |
| 186 <div class="g-unit" id="gc-pagecontent"> |
| 187 <div id="pageTitle"> |
| 188 <h1 class="page_title">Autoupdating</h1> |
| 189 </div> |
| 190 <!-- TABLE OF CONTENTS --> |
| 191 <div id="toc"> |
| 192 <h2>Contents</h2> |
| 193 <ol> |
| 194 <li> |
| 195 <a href="#H2-0">Overview</a> |
| 196 <ol> |
| 197 </ol> |
| 198 </li><li> |
| 199 <a href="#H2-1">Update URL</a> |
| 200 <ol> |
| 201 </ol> |
| 202 </li><li> |
| 203 <a href="#H2-2">Update manifest</a> |
| 204 <ol> |
| 205 </ol> |
| 206 </li><li> |
| 207 <a href="#H2-3">Testing</a> |
| 208 <ol> |
| 209 </ol> |
| 210 </li><li> |
| 211 <a href="#H2-4">Advanced usage: request parameters</a> |
| 212 <ol> |
| 213 </ol> |
| 214 </li><li> |
| 215 <a href="#H2-5">Advanced usage: minimum browser version</a> |
| 216 <ol> |
| 217 </ol> |
| 218 </li> |
| 219 </ol> |
| 220 </div> |
| 221 <!-- /TABLE OF CONTENTS --> |
| 222 <!-- Standard content lead-in for experimental API pages --> |
| 223 <!-- STATIC CONTENT PLACEHOLDER --> |
| 224 <div id="static"><div id="pageData-name" class="pageData">Autoupdating</
div> |
| 225 <div id="pageData-showTOC" class="pageData">true</div> |
| 226 <p>We want extensions to be autoupdated for some of the same reasons as Google C
hrome itself: to incorporate bug and security fixes, add new features or perform
ance enhancements, and improve user interfaces.</p> |
| 227 <p>If you publish your extension using the <a href="https://chrome.google.com/we
bstore/developer/dashboard">Chrome Developer Dashboard</a>, you can <em>ignore t
his page</em>. You can use the dashboard to release updated versions of your ext
ension to users, as well as to the Chrome Web Store.</p> |
| 228 <p>If you want to host your extension somewhere other than the store, keep readi
ng. |
| 229 You should also read <a href="hosting.html">Hosting</a> and |
| 230 <a href="packaging.html">Packaging</a>.</p> |
| 231 <a name="H2-0"></a><h2>Overview</h2> |
| 232 <ul><li>An extension manifest may contain an "update_url" field, pointing to a l
ocation for doing update checks.</li> |
| 233 <li>The content returned by an update check is an <em>update manifest</em> XML d
ocument listing the latest version of an extension.</li></ul> |
| 234 <p>Every few hours, the browser checks whether any installed extensions have an
update URL. For each one, it makes a request to that URL looking for an update m
anifest XML file. If the update manifest mentions a version of an extension that
is more recent than what's installed, the browser downloads and installs the ne
w version. As with manual updates, the new <code>.crx</code> file must be signed
with the same private key as the currently installed version.</p> |
| 235 <a name="H2-1"></a><h2>Update URL</h2> |
| 236 <p>If you're hosting your own extension, you need to add the "update_url" field
to your <a href="manifest.html"><code>manifest.json</code></a> file, |
| 237 like this:</p> |
| 238 <pre>{ |
| 239 "name": "My extension", |
| 240 ... |
| 241 <b>"update_url": "http://myhost.com/mytestextension/updates.xml"</b>, |
| 242 ... |
| 243 } |
| 244 </pre> |
| 245 <a name="H2-2"></a><h2>Update manifest</h2> |
| 246 <p>The update manifest returned by the server should be an XML document that loo
ks like this (highlights indicate parts you should modify):</p> |
| 247 <pre><?xml version='1.0' encoding='UTF-8'?> |
| 248 <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> |
| 249 <app appid='<b>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</b>'> |
| 250 <updatecheck codebase='<b>http://myhost.com/mytestextension/mte
_v2.crx</b>' version='<b>2.0</b>' /> |
| 251 </app> |
| 252 </gupdate> |
| 253 </pre> |
| 254 <p>This XML format is borrowed from that used by Omaha, Google's update infrastr
ucture. See <a href="http://code.google.com/p/omaha/">http://code.google.com/p/o
maha/</a> for more details. |
| 255 The extensions system uses the following attributes |
| 256 for the <strong><app></strong> |
| 257 and <strong><updatecheck></strong> elements of the update manifest: |
| 258 </p> |
| 259 <p><b>appid</b><br> |
| 260 The extension ID, generated based on a hash of the extension's public key, |
| 261 as described in <a href="packaging.html">Packaging</a>. You can find the |
| 262 ID of an extension or packaged app by going to the Extensions page (<b>chrome://
extensions</b>). |
| 263 Hosted apps, however, are not listed on the Extensions page. You can find the I
D of any |
| 264 app using the following steps: |
| 265 </p> |
| 266 <ul> |
| 267 <li> Open the app. You can do this by clicking its icon on the New Tab page.</
li> |
| 268 <li> Open the JavaScript console. You can do this by clicking the wrench icon |
| 269 and choosing <b>Tools > JavaScript Console</b>.</li> |
| 270 <li> Enter the following expression into the JavaScript console: <code>chrome.
app.getDetails().id</code> |
| 271 <p>The console shows the app's ID as a quoted string.</p> |
| 272 </li> |
| 273 </ul> |
| 274 <p><b>codebase</b><br> |
| 275 A URL to the extension's <code>.crx</code> file.</p> |
| 276 <p><b>version</b><br> |
| 277 Used by the client to determine whether it should download the <code>.crx</code>
file specified by <code>codebase</code>. It should match the value of "version"
in the <code>.crx</code> file's <code>manifest.json</code> file.</p> |
| 278 <p>The update manifest XML file may contain information about multiple extension
s by including multiple <app> elements.</p> |
| 279 <a name="H2-3"></a><h2>Testing</h2> |
| 280 <p>The default update check frequency is several hours, |
| 281 but you can force an update using the Extensions page's |
| 282 <b>Update extensions now</b> button. |
| 283 </p> |
| 284 <p> |
| 285 Another option is to use the --extensions-update-frequency command-line flag to
set a more frequent interval in seconds. For example, to make checks run every 4
5 seconds, run Google Chrome like this:</p> |
| 286 <pre>chrome.exe <b>--extensions-update-frequency=45</b></pre> |
| 287 <p>Note that this affects checks for all installed extensions, so consider the b
andwidth and server load implications of this. You may want to temporarily unins
tall all but the one extension you are testing with, and should not run with thi
s option turned on during normal browser usage.</p> |
| 288 <a name="H2-4"></a><h2>Advanced usage: request parameters</h2> |
| 289 <p>The basic autoupdate mechanism is designed to make the server-side work as ea
sy as just dropping a static XML file onto any plain web server such as Apache,
and updating that XML file as you release new versions of your extensions.</p> |
| 290 <p>More advanced developers may wish to take advantage of the fact that we add o
n parameters to the request for the update manifest to indicate the extension ID
and version. Then they can use the same update URL for all of their extensions,
pointing to a URL running dynamic server-side code instead of a static XML file
.</p> |
| 291 <p>The format of the request parameters is:</p> |
| 292 <p><code> ?x=<em><extension_data></em></code></p> |
| 293 <p>Where <code><em><extension_data></em></code> is a URL-encoded string of
the format:</p> |
| 294 <p><code> <em>id=<id></em>&v=<em><version></em></code
></p> |
| 295 <p>For example, say you have two extensions, |
| 296 both of which point to the same update URL |
| 297 (<code>http://test.com/extension_updates.php</code>): |
| 298 </p> |
| 299 <ul> |
| 300 <li> Extension 1 |
| 301 <ul> |
| 302 <li> ID: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" </li> |
| 303 <li> Version: "1.1"</li> |
| 304 </ul> |
| 305 </li><li> Extension 2 |
| 306 <ul> |
| 307 <li> ID: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" </li> |
| 308 <li> Version: "0.4"</li> |
| 309 </ul> |
| 310 </li></ul> |
| 311 <p>The request to update each individual extension would be:</p> |
| 312 <ul> |
| 313 <li> <code>http://test.com/extension_updates.php?x=id%3Daaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaa%26v%3D1.1</code> </li> |
| 314 <li> <code>http://test.com/extension_updates.php?x=id%3Dbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbb%26v%3D0.4</code> </li> |
| 315 </ul> |
| 316 <p> |
| 317 Multiple extensions can be listed in a single request for each unique update URL
. |
| 318 For the above example, if a user has both of the extensions installed, |
| 319 then the two requests are merged into a single request:</p> |
| 320 <p><code>http://test.com/extension_updates.php?x=id%3Daaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaa%26v%3D1.1&x=id%3Dbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb%26v%3D0.4</code></p
> |
| 321 <p>If the number of installed extensions using the same update URL is large enou
gh that a GET request URL is too long (over 2000 characters or so), the update c
heck issues additional GET requests as necessary.</p> |
| 322 <p class="note"> |
| 323 <b>Note:</b> |
| 324 In the future, instead of issuing multiple GET requests, |
| 325 a single POST request might be issued |
| 326 with the request parameters in the POST body. |
| 327 </p> |
| 328 <a name="H2-5"></a><h2>Advanced usage: minimum browser version</h2> |
| 329 <p>As we add more APIs to the extensions system, it's possible you will want to
release an updated version of an extension that will work only with newer versio
ns of the browser. While Google Chrome itself is autoupdated, it can take a few
days before the majority of the user base has updated to any given new release.
To ensure that a given extension update will apply only to Google Chrome version
s at or higher than a specific version, you add the "prodversionmin" attribute t
o the <app> element in your update manifest. For example:</p> |
| 330 <pre><?xml version='1.0' encoding='UTF-8'?> |
| 331 <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> |
| 332 <app appid='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'> |
| 333 <updatecheck codebase='http://myhost.com/mytestextens
ion/mte_v2.crx' version='2.0' <b>prodversionmin='3.0.193.0'</b>/> |
| 334 </app> |
| 335 </gupdate> |
| 336 </pre> |
| 337 <p>This would ensure that users of this extension would autoupdate to version 2
only if they are running Google Chrome 3.0.193.0 or greater.</p> |
| 338 </div> |
| 339 <!-- API PAGE --> |
| 340 <!-- /apiPage --> |
| 341 </div> <!-- /gc-pagecontent --> |
| 342 </div> <!-- /g-section --> |
| 343 </div> <!-- /codesiteContent --> |
| 344 <div id="gc-footer" --=""> |
| 345 <div class="text"> |
| 346 <p> |
| 347 Except as otherwise <a href="http://code.google.com/policies.html#restrictions
">noted</a>, |
| 348 the content of this page is licensed under the <a rel="license" href="http://c
reativecommons.org/licenses/by/3.0/">Creative Commons |
| 349 Attribution 3.0 License</a>, and code samples are licensed under the |
| 350 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic
ense</a>. |
| 351 </p> |
| 352 <p> |
| 353 ©2011 Google |
| 354 </p> |
| 355 <!-- begin analytics --> |
| 356 <script src="https://www.google-analytics.com/urchin.js" type="text/javascript">
</script> |
| 357 <script src="https://www.google-analytics.com/ga.js" type="text/javascript"></sc
ript> |
| 358 <script type="text/javascript"> |
| 359 // chrome doc tracking |
| 360 try { |
| 361 var engdocs = _gat._getTracker("YT-10763712-2"); |
| 362 engdocs._trackPageview(); |
| 363 } catch(err) {} |
| 364 // code.google.com site-wide tracking |
| 365 try { |
| 366 _uacct="UA-18071-1"; |
| 367 _uanchor=1; |
| 368 _uff=0; |
| 369 urchinTracker(); |
| 370 } |
| 371 catch(e) {/* urchinTracker not available. */} |
| 372 </script> |
| 373 <!-- end analytics --> |
| 374 </div> |
| 375 </div> <!-- /gc-footer --> |
| 376 </div> <!-- /gc-container --> |
| 377 </body></html> |
OLD | NEW |