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