Home | History | Annotate | Download | only in static
      1 <div id="pageData-name" class="pageData">Other Deployment Options</div>
      2 <div id="pageData-showTOC" class="pageData">true</div>
      3 
      4 <p>
      5 Usually, users install their own extensions.
      6 But sometimes you might want an extension
      7 to be installed automatically.
      8 Here are two typical cases:
      9 </p>
     10 
     11 <ul>
     12   <li>
     13     An extension is associated with some other software,
     14     and the extension should be installed
     15     whenever the user installs that other software.
     16     The extension could also be uninstalled
     17     when the user removes that other software.
     18   </li>
     19   <li>
     20     A network admin wants to install the same extensions
     21     throughout the company.
     22   </li>
     23 </ul>
     24 
     25 <p>
     26 An extension that's installed automatically is known as an
     27 <em>external extension</em>.
     28 Google Chrome supports two ways of
     29 installing external extensions:
     30 </p>
     31 
     32 <ul>
     33   <li> Using a preferences JSON file </li>
     34   <li> Using the Windows registry (Windows only) </li>
     35 </ul>
     36 
     37 <p>
     38 Both ways support installing an extension from a <code>.crx</code> extension
     39 file on the user's computer.  The preferences JSON file also supports installing
     40 an extension hosted at an
     41 <a href="autoupdate.html#H2-1">update URL</a>.
     42 See <a href="hosting.html">hosting</a> for details on hosting an extension.
     43 </p>
     44 
     45 <h2 id="prereqs">Before you begin</h2>
     46 
     47 <p>
     48 First, package a
     49 <a href="packaging.html"><code>.crx</code> file</a>
     50 and make sure that it installs successfully.
     51 </p>
     52 <p>
     53 If you wish to install from an
     54  <a href="autoupdate.html#H2-1">update URL</a>, ensure that the extension
     55 is properly <a href="hosting.html">hosted</a>.
     56 </p>
     57 
     58 <p>
     59 Then, before you edit the preferences file or the registry,
     60 make a note of the following:
     61 </p>
     62 
     63 <ul>
     64  <li> The intended <b>location</b> of the extension's <code>.crx</code> file,
     65         or the update URL from which it is served </li>
     66  <li> The extension's <b>version</b>
     67    (from the manifest file or the <b>chrome://extensions</b> page) </li>
     68  <li> The extension's <b>ID</b>
     69    (from the <b>chrome://extensions</b> page
     70    when you've loaded the packed extension) </li>
     71 </ul>
     72 
     73 <p>
     74 The following examples assume the version is <code>1.0</code>
     75 and the ID is <code>aaaaaaaaaabbbbbbbbbbcccccccccc</code>.
     76 </p>
     77 
     78 <h2 id="preferences">Using a preferences file</h2>
     79 
     80 <p class="note">
     81 <b>Windows note:</b>
     82 Until <a href="http://crbug.com/41902">bug 41902</a> is fixed,
     83 you might want to use the <a href="#registry">Windows registry</a>
     84 instead of the preferences file.
     85 
     86 </p>
     87 
     88 <ol>
     89 <li>If you are installing from a file, make the <code>.crx</code> extension
     90 file available to the machine you want to install the extension on.
     91 (Copy it to a local directory or to a network share for example,
     92 <code>\\server\share\extension.crx</code>
     93 or <code>/home/share/extension.crx</code>.)
     94 </li>
     95 <li>Locate the <code>external_extensions.json</code> file
     96   under the Google Chrome installation directory.
     97   If the file doesn't exist, create it.
     98   The location depends on the operating system.
     99   <dl>
    100   <dt> Windows: </dt>
    101     <dd> <code><em>chrome_root</em>\Application\<em>chrome_version</em>\Extensions\</code>
    102     <br />
    103     Example: <code>c:\Users\Me\AppData\Local\Google\Chrome\Application\6.0.422.0\Extensions\</code>
    104     </dd>
    105   <dt> Mac OS X: </dt>
    106     <dd> <code>/Applications/Google Chrome.app/Contents/Extensions/</code> </dd>
    107   <dt> Linux: </dt>
    108     <dd> <code>/opt/google/chrome/extensions/</code> <br>
    109     <b>Note:</b> Use <code>chmod</code> if necessary
    110     to make sure that <code>extensions/external_extensions.json</code>
    111     is world-readable.
    112     </dd>
    113   </dl>
    114 </li>
    115 <li> Add an entry to <code>external_extensions.json</code>
    116 for your extension's ID.  If you are installing from a file, specify the
    117 extension's location and version with fields named "external_crx" and
    118 "external_version".
    119 
    120 Example:
    121 <pre>{
    122   "aaaaaaaaaabbbbbbbbbbcccccccccc": {
    123     "external_crx": "/home/share/extension.crx",
    124     "external_version": "1.0"
    125   }
    126 }</pre>
    127 
    128 <p class="note">
    129 <b>Note:</b>
    130 You need to escape
    131 each <code>\</code> character in the location.
    132 For example,
    133 <code>\\server\share\extension.crx</code> would be
    134 <code>"\\\\server\\share\\extension.crx"</code>.
    135 </p>
    136 <p>
    137 If you are installing from an update URL, specify the extension's update URL
    138 with field name "external_update_url".
    139 </p>
    140 Example:
    141 <pre>{
    142   "aaaaaaaaaabbbbbbbbbbcccccccccc": {
    143     "external_update_url": "http://myhost.com/mytestextension/updates.xml"
    144   }
    145 }</pre>
    146 </li>
    147 
    148 <li>Save the JSON file. </li>
    149 <li>Launch Google Chrome and go to <b>chrome://extensions</b>;
    150 you should see the extension listed. </li>
    151 </ol>
    152 
    153 <h2 id="registry">Using the Windows registry</h2>
    154 
    155 <ol>
    156 <li>Make the <code>.crx</code> extension file available
    157 to the machine you want to install the extension on.
    158 (Copy it to a local directory or to a network share &mdash;
    159 for example, <code>\\server\share\extension.crx</code>.)
    160 </li>
    161 <li>Find or create the following key in the
    162 registry:
    163 <ul>
    164   <li> 32-bit Windows: <code>HKEY_LOCAL_MACHINE\Software\Google\Chrome\Extensions</code> </li>
    165   <li> 64-bit Windows: <code>HKEY_LOCAL_MACHINE\Software\Wow6432Node\Google\Chrome\Extensions</code> </li>
    166 </ul>
    167 </li>
    168 
    169 <li>Create a new key (folder)
    170 under the <b>Extensions</b> key with the
    171 same name as the ID of your extension
    172 (for example, <code>aaaaaaaaaabbbbbbbbbbcccccccccc</code>).
    173 </li>
    174 <li>Create two string values (<code>REG_SZ</code>) named "path" and "version",
    175   and set them to the extension's location and version.
    176   For example:
    177 <ul>
    178   <li>path: <code>\\server\share\extension.crx</code> </li>
    179   <li>version: <code>1.0</code> </li>
    180 </ul>
    181 </li>
    182 <li>Launch the browser and go to
    183 <b>chrome://extensions</b>; you should
    184 see the extension listed. </li>
    185 </ol>
    186 
    187 <h2 id="updating">Updating and uninstalling</h2>
    188 
    189 <p>Google Chrome scans the metadata entries
    190 in the preferences and registry
    191 each time the browser starts, and makes
    192 any necessary changes to the installed
    193 external extensions. </p>
    194 
    195 <p>To update your extension to a new version,
    196 update the file, and then update the version
    197 in the preferences or registry. </p>
    198 
    199 <p>To uninstall your extension
    200 (for example, if your software is uninstalled),
    201 remove the metadata from the preferences file
    202 or registry. </p>
    203 
    204 <h2 id="faq">FAQ</h2>
    205 
    206 <p>
    207 This section answers common questions about external extensions.
    208 </p>
    209 
    210 <br>
    211 
    212 <p><b>Can I specify a URL as a path to the external extension?</b> </p>
    213 <p>Yes, if you host the extension as explained in
    214 <a href="hosting.html">hosting</a>.
    215 </p>
    216 
    217 <br>
    218 
    219 <p><b>What are some common mistakes when installing with the preferences
    220 file?</b></p>
    221 <ul>
    222   <li>
    223     Not specifying the same id/version
    224     as the one listed in the <code>.crx</code> </li>
    225   <li>
    226     <code>external_extensions.json</code> is in the wrong location </li>
    227   <li>
    228     Syntax error in JSON file
    229     (forgetting to separate entries with comma or
    230     leaving a trailing comma somewhere) </li>
    231   <li>
    232     Extra curly brackets around the top level dictionary </li>
    233   <li>
    234     JSON file entry points to the wrong path
    235     to the <code>.crx</code> (or path specified but no filename) </li>
    236   <li>
    237     Backslashes in UNC path not escaped
    238     (for example, <code>"\\server\share\file"</code> is wrong;
    239     it should be <code>"\\\\server\\share\\extension"</code>) </li>
    240   <li>
    241     Permissions problems on a network share </li>
    242 </ul>
    243 
    244 <br>
    245 
    246 <p><b>What are some common mistakes when installing with the registry?</b> </p>
    247 <ul>
    248   <li>Not specifying the same id/version
    249     as the one listed in the <code>.crx</code> </li>
    250   <li>Key created in the wrong location in the registry </li>
    251   <li>Registry entry points to the wrong path to the <code>.crx</code> file
    252     (or path specified but no filename) </li>
    253   <li>Permissions problems on a network share </li>
    254 </ul>
    255 
    256 <br>
    257 
    258 <p><b>What if the user uninstalls the extension?</b> </p>
    259 <p>If the user uninstalls the extension through the UI, it will no
    260 longer be installed or updated on each startup. In other words, the
    261 external extension is blacklisted. </p>
    262 
    263 <br>
    264 
    265 <p><b>How do I get off the blacklist?</b> </p>
    266 <p>If the user uninstalls your extension, you should respect that
    267 decision. However, if you (the developer) accidentally uninstalled
    268 your extension through the UI,
    269 you can remove the blacklist tag
    270 by installing the extension normally
    271 through the UI, and then uninstalling it. </p>
    272