OLD | NEW |
| (Empty) |
1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: | |
2 1) The <head> information in this page is significant, should be uniform | |
3 across api docs and should be edited only with knowledge of the | |
4 templating mechanism. | |
5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a | |
6 browser, it will be re-generated from the template, json schema and | |
7 authored overview content. | |
8 4) The <body>.innerHTML is also generated by an offline step so that this | |
9 page may easily be indexed by search engines. | |
10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> | |
11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
12 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css"> | |
13 <link href="css/print.css" rel="stylesheet" type="text/css" media="print"> | |
14 <script type="text/javascript" src="../../../third_party/jstemplate/jstempla
te_compiled.js"> | |
15 </script> | |
16 <script type="text/javascript" src="../../../../third_party/json_minify/mini
fy-sans-regexp.js"> | |
17 </script> | |
18 <script type="text/javascript" src="js/api_page_generator.js"></script> | |
19 <script type="text/javascript" src="js/bootstrap.js"></script> | |
20 <script type="text/javascript" src="js/sidebar.js"></script> | |
21 <title>Override Pages - Google Chrome Extensions - Google Code</title></head> | |
22 <body> <div id="devModeWarning" class="displayModeWarning"> | |
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. | |
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 class="leftNavSelected">Override Pages</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">Override Pages</h1> | |
189 </div> | |
190 <!-- TABLE OF CONTENTS --> | |
191 <div id="toc"> | |
192 <h2>Contents</h2> | |
193 <ol> | |
194 <li> | |
195 <a href="#manifest">Manifest</a> | |
196 <ol> | |
197 </ol> | |
198 </li><li> | |
199 <a href="#tips">Tips</a> | |
200 <ol> | |
201 </ol> | |
202 </li><li> | |
203 <a href="#examples"> Examples </a> | |
204 <ol> | |
205 </ol> | |
206 </li> | |
207 </ol> | |
208 </div> | |
209 <!-- /TABLE OF CONTENTS --> | |
210 <!-- Standard content lead-in for experimental API pages --> | |
211 <!-- STATIC CONTENT PLACEHOLDER --> | |
212 <div id="static"><div id="pageData-name" class="pageData">Override Pages
</div> | |
213 <div id="pageData-showTOC" class="pageData">true</div> | |
214 <style> | |
215 #pics { | |
216 margin:2em 1em 1.5em; | |
217 } | |
218 #pics td { | |
219 text-align:center; | |
220 width:50%!important; | |
221 border:none; | |
222 padding:0 1em; | |
223 font-size:90%; | |
224 } | |
225 #pics img { | |
226 width:188; | |
227 height:246; | |
228 border:none; | |
229 } | |
230 </style> | |
231 <p> | |
232 Override pages are a way to substitute an HTML file from your extension | |
233 for a page that Google Chrome normally provides. | |
234 In addition to HTML, | |
235 an override page usually has CSS and JavaScript code. | |
236 </p> | |
237 <p> | |
238 An extension can replace any one of the following pages: | |
239 </p><ul> | |
240 <li> <b>Bookmark Manager:</b> | |
241 The page that appears when the user chooses | |
242 the Bookmark Manager menu item | |
243 from the wrench menu or, on Mac, | |
244 the Bookmark Manager item from the Bookmarks menu. | |
245 You can also get to this page by entering the URL | |
246 <b>chrome://bookmarks</b>. | |
247 </li> | |
248 <li> <b>History:</b> | |
249 The page that appears when the user | |
250 chooses the History menu item | |
251 from the Tools (wrench) menu or, on Mac, | |
252 the Show Full History item from the History menu. | |
253 You can also get to this page by entering the URL | |
254 <b>chrome://history</b>. | |
255 </li> | |
256 <li> <b>New Tab:</b> | |
257 The page that appears when the user creates a new tab or window. | |
258 You can also get to this page by entering the URL | |
259 <b>chrome://newtab</b>. | |
260 </li> | |
261 </ul> | |
262 <p></p> | |
263 <p class="note"> | |
264 <b>Note:</b> | |
265 A single extension can override | |
266 <b>only one page</b>. | |
267 For example, an extension can't override both | |
268 the Bookmark Manager and History pages. | |
269 </p> | |
270 <p> | |
271 Incognito windows are treated specially. | |
272 New Tab pages cannot be overridden in incognito windows. | |
273 Other override pages work in incognito windows | |
274 as long as the | |
275 <a href="manifest.html#incognito">incognito</a> | |
276 manifest property is set to "spanning" | |
277 (which is the default value for extensions | |
278 but not for packaged apps). | |
279 See <a href="overview.html#incognito">Saving data and incognito mode</a> | |
280 in the Overview for more details on how you should treat | |
281 incognito windows. | |
282 </p> | |
283 <p> | |
284 The following screenshots show the default New Tab page | |
285 next to a custom New Tab page. | |
286 </p> | |
287 <table id="pics"> | |
288 <tbody><tr> | |
289 <td> <b>The default New Tab page</b> </td> | |
290 <td> <b>An alternative New Tab page</b> </td> | |
291 </tr> | |
292 <tr> | |
293 <td> | |
294 <img src="images/ntp-default.png" alt="default New Tab page" width="200" h
eight="173"> | |
295 </td> | |
296 <td> | |
297 <img src="images/ntp-blank.png" alt="a blank New Tab page" width="200" hei
ght="173"> | |
298 </td> | |
299 </tr> | |
300 </tbody></table> | |
301 <h2 id="manifest">Manifest</h2> | |
302 <p> | |
303 Register an override page in the | |
304 <a href="manifest.html">extension manifest</a> like this: | |
305 </p> | |
306 <pre>{ | |
307 "name": "My extension", | |
308 ... | |
309 <b> "chrome_url_overrides" : { | |
310 "<em>pageToOverride</em>": "<em>myPage.html</em>" | |
311 }</b>, | |
312 ... | |
313 }</pre> | |
314 <p> | |
315 For <code><em>pageToOverride</em></code>, substitute one of the following: | |
316 </p> | |
317 <ul> | |
318 <li> <code>bookmarks</code> | |
319 </li><li> <code>history</code> | |
320 </li><li> <code>newtab</code> | |
321 </li></ul> | |
322 <h2 id="tips">Tips</h2> | |
323 <p> | |
324 For an effective override page, follow these guidelines: | |
325 </p> | |
326 <ul> | |
327 <li> | |
328 <p> | |
329 <b>Make your page quick and small.</b> <br> | |
330 Users expect built-in browser pages to open instantly. | |
331 Avoid doing things that might take a long time. | |
332 For example, avoid synchronous fetches of network or database resources. | |
333 </p> | |
334 </li> | |
335 <li> | |
336 <p> | |
337 <b>Include a title in your page.</b> <br> | |
338 Otherwise people might see the URL of the page, | |
339 which could be confusing. | |
340 Here's an example of specifying the title: | |
341 <code><title>New Tab</title></code> | |
342 </p> | |
343 </li> | |
344 <li> | |
345 <p> | |
346 <b>Don't rely on the page having the keyboard focus.</b> <br> | |
347 The address bar always gets the focus first | |
348 when the user creates a new tab. | |
349 </p> | |
350 </li> | |
351 <li> | |
352 <p> | |
353 <b>Don't try to emulate the default New Tab page.</b> <br> | |
354 The APIs necessary to create | |
355 a slightly modified version of the default New Tab page — | |
356 with top pages, | |
357 recently closed pages, | |
358 tips, | |
359 a theme background image, | |
360 and so on — | |
361 don't exist yet. | |
362 Until they do, | |
363 you're better off trying to make something completely different. | |
364 </p> | |
365 </li> | |
366 </ul> | |
367 <h2 id="examples"> Examples </h2> | |
368 <p> | |
369 See the | |
370 <a href="samples.html#chrome_url_overrides">override samples</a>. | |
371 </p> | |
372 </div> | |
373 <!-- API PAGE --> | |
374 <!-- /apiPage --> | |
375 </div> <!-- /gc-pagecontent --> | |
376 </div> <!-- /g-section --> | |
377 </div> <!-- /codesiteContent --> | |
378 <div id="gc-footer" --=""> | |
379 <div class="text"> | |
380 <p> | |
381 Except as otherwise <a href="http://code.google.com/policies.html#restrictions
">noted</a>, | |
382 the content of this page is licensed under the <a rel="license" href="http://c
reativecommons.org/licenses/by/3.0/">Creative Commons | |
383 Attribution 3.0 License</a>, and code samples are licensed under the | |
384 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic
ense</a>. | |
385 </p> | |
386 <p> | |
387 ©2011 Google | |
388 </p> | |
389 <!-- begin analytics --> | |
390 <script src="https://www.google-analytics.com/urchin.js" type="text/javascript">
</script> | |
391 <script src="https://www.google-analytics.com/ga.js" type="text/javascript"></sc
ript> | |
392 <script type="text/javascript"> | |
393 // chrome doc tracking | |
394 try { | |
395 var engdocs = _gat._getTracker("YT-10763712-2"); | |
396 engdocs._trackPageview(); | |
397 } catch(err) {} | |
398 // code.google.com site-wide tracking | |
399 try { | |
400 _uacct="UA-18071-1"; | |
401 _uanchor=1; | |
402 _uff=0; | |
403 urchinTracker(); | |
404 } | |
405 catch(e) {/* urchinTracker not available. */} | |
406 </script> | |
407 <!-- end analytics --> | |
408 </div> | |
409 </div> <!-- /gc-footer --> | |
410 </div> <!-- /gc-container --> | |
411 </body></html> | |
OLD | NEW |