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