OLD | NEW |
| (Empty) |
1 <!-- BEGIN AUTHORED CONTENT --> | |
2 <p id="classSummary"> | |
3 Use the <code>chrome.history</code> module to interact with the | |
4 browser's record of visited pages. You can add, remove, and query | |
5 for URLs in the browser's history. | |
6 To override the history page with your own version, see | |
7 <a href="override.html">Override Pages</a>. | |
8 </p> | |
9 <h2 id="manifest">Manifest</h2> | |
10 <p>You must declare the "history" permission | |
11 in the <a href="manifest.html">extension manifest</a> | |
12 to use the history API. | |
13 For example:</p> | |
14 <pre>{ | |
15 "name": "My extension", | |
16 ... | |
17 <b>"permissions": [ | |
18 "history" | |
19 ]</b>, | |
20 ... | |
21 }</pre> | |
22 <h2 id="transition_types">Transition types</h2> | |
23 <p> | |
24 The history API uses a <em>transition type</em> to describe | |
25 how the browser navigated to a particular URL | |
26 on a particular visit. | |
27 For example, if a user visits a page | |
28 by clicking a link on another page, | |
29 the transition type is "link". | |
30 </p> | |
31 <p> | |
32 The following table describes each transition type. | |
33 </p> | |
34 <table> | |
35 <tr> | |
36 <th> Transition type </th> <th> Description </th> | |
37 </tr> | |
38 <tr id="tt_link"> | |
39 <td>"link"</td> | |
40 <td> | |
41 The user got to this page by clicking a link on another page. | |
42 </td> | |
43 </tr> | |
44 <tr id="tt_typed"> | |
45 <td>"typed"</td> | |
46 <td> | |
47 The user got this page by typing the URL in the address bar. | |
48 Also used for other explicit navigation actions. | |
49 See also <a href="#tt_generated">generated</a>, | |
50 which is used for cases where the user selected a choice | |
51 that didn't look at all like a URL. | |
52 </td> | |
53 </tr> | |
54 <tr id="tt_auto_bookmark"> | |
55 <td>"auto_bookmark"</td> | |
56 <td> | |
57 The user got to this page through a suggestion in the UI — | |
58 for example, through a menu item. | |
59 </td> | |
60 </tr> | |
61 <tr id="tt_auto_subframe"> | |
62 <td>"auto_subframe"</td> | |
63 <td> | |
64 Subframe navigation. | |
65 This is any content that is automatically | |
66 loaded in a non-top-level frame. | |
67 For example, if a page consists of | |
68 several frames containing ads, | |
69 those ad URLs have this transition type. | |
70 The user may not even realize the content in these pages | |
71 is a separate frame, and so may not care about the URL | |
72 (see also <a href="#tt_manual_subframe">manual_subframe</a>). | |
73 </td> | |
74 </tr> | |
75 <tr id="tt_manual_subframe"> | |
76 <td>"manual_subframe"</td> | |
77 <td> | |
78 For subframe navigations that are explicitly requested by the user | |
79 and generate new navigation entries in the back/forward list. | |
80 An explicitly requested frame is probably more important than | |
81 an automatically loaded frame | |
82 because the user probably cares about the fact that | |
83 the requested frame was loaded. | |
84 </td> | |
85 </tr> | |
86 <tr id="tt_generated"> | |
87 <td>"generated"</td> | |
88 <td> | |
89 The user got to this page by typing in the address bar | |
90 and selecting an entry that did not look like a URL. | |
91 For example, a match might have the URL of a Google search result page, | |
92 but it might appear to the user as "Search Google for ...". | |
93 These are not quite the same as <a href="#tt_typed">typed</a> navigations | |
94 because the user didn't type or see the destination URL. | |
95 See also <a href="#tt_keyword">keyword</a>. | |
96 </td> | |
97 </tr> | |
98 <tr id="tt_start_page"> | |
99 <td>"start_page"</td> | |
100 <td> | |
101 The page was specified in the command line or is the start page. | |
102 </td> | |
103 </tr> | |
104 <tr id="tt_form_submit"> | |
105 <td>"form_submit"</td> | |
106 <td> | |
107 The user filled out values in a form and submitted it. | |
108 Note that in some situations — | |
109 such as when a form uses script to submit contents — | |
110 submitting a form does not result in this transition type. | |
111 </td> | |
112 </tr> | |
113 <tr id="tt_reload"> | |
114 <td>"reload"</td> | |
115 <td> | |
116 The user reloaded the page, | |
117 either by clicking the reload button | |
118 or by pressing Enter in the address bar. | |
119 Session restore and Reopen closed tab use this transition type, too. | |
120 </td> | |
121 </tr> | |
122 <tr id="tt_keyword"> | |
123 <td>"keyword"</td> | |
124 <td> | |
125 The URL was generated from a replaceable keyword | |
126 other than the default search provider. | |
127 See also | |
128 <a href="#tt_keyword_generated">keyword_generated</a>. | |
129 </td> | |
130 </tr> | |
131 <tr id="tt_keyword_generated"> | |
132 <td>"keyword_generated"</td> | |
133 <td> | |
134 Corresponds to a visit generated for a keyword. | |
135 See also <a href="#tt_keyword">keyword</a>. | |
136 </td> | |
137 </tr> | |
138 </table> | |
139 <h2 id="examples">Examples</h2> | |
140 <p> | |
141 For examples of using this API, see the | |
142 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension
s/docs/examples/api/history/">history sample directory</a> and the | |
143 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extens
ions/api_test/history/">history API test directory</a>. | |
144 For other examples and for help in viewing the source code, see | |
145 <a href="samples.html">Samples</a>. | |
146 </p> | |
147 <!-- END AUTHORED CONTENT --> | |
OLD | NEW |