OLD | NEW |
1 <h2 id="manifest">Manifest</h2> | 1 <h2 id="manifest">Manifest</h2> |
2 <p> | 2 <p> |
3 All <code>chrome.webNavigation</code> methods and events require you to declare | 3 All <code>chrome.webNavigation</code> methods and events require you to declare |
4 the "webNavigation" permission in the <a href="manifest.html">extension | 4 the "webNavigation" permission in the <a href="manifest">extension |
5 manifest</a>. | 5 manifest</a>. |
6 For example: | 6 For example: |
7 </p> | 7 </p> |
8 | 8 |
9 <pre data-filename="manifest.json"> | 9 <pre data-filename="manifest.json"> |
10 { | 10 { |
11 "name": "My extension", | 11 "name": "My extension", |
12 ... | 12 ... |
13 <b>"permissions": [ | 13 <b>"permissions": [ |
14 "webNavigation" | 14 "webNavigation" |
15 ]</b>, | 15 ]</b>, |
16 ... | 16 ... |
17 } | 17 } |
18 </pre> | 18 </pre> |
19 | 19 |
20 | 20 |
21 <h2 id="examples">Examples</h2> | 21 <h2 id="examples">Examples</h2> |
22 | 22 |
23 <p> | 23 <p> |
24 You can find simple examples of using the tabs module in the | 24 You can find simple examples of using the tabs module in the |
25 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension
s/docs/examples/api/webNavigation/">examples/api/webNavigation</a> | 25 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension
s/docs/examples/api/webNavigation/">examples/api/webNavigation</a> |
26 directory. | 26 directory. |
27 For other examples and for help in viewing the source code, see | 27 For other examples and for help in viewing the source code, see |
28 <a href="samples.html">Samples</a>. | 28 <a href="samples">Samples</a>. |
29 </p> | 29 </p> |
30 | 30 |
31 <h2 id="event_order">Event order</h2> | 31 <h2 id="event_order">Event order</h2> |
32 <p> | 32 <p> |
33 For a navigation that is successfully completed, events are fired in the | 33 For a navigation that is successfully completed, events are fired in the |
34 following order: | 34 following order: |
35 <pre> | 35 <pre> |
36 onBeforeNavigate -> onCommitted -> onDOMContentLoaded -> onCompleted | 36 onBeforeNavigate -> onCommitted -> onDOMContentLoaded -> onCompleted |
37 </pre> | 37 </pre> |
38 </p> | 38 </p> |
(...skipping 24 matching lines...) Expand all Loading... |
63 href="https://support.google.com/chrome/bin/answer.py?answer=177873">Chrome | 63 href="https://support.google.com/chrome/bin/answer.py?answer=177873">Chrome |
64 Instant</a> or <a | 64 Instant</a> or <a |
65 href="https://support.google.com/chrome/bin/answer.py?answer=1385029">Instant | 65 href="https://support.google.com/chrome/bin/answer.py?answer=1385029">Instant |
66 Pages</a>, a completely loaded page is swapped into the current tab. In that | 66 Pages</a>, a completely loaded page is swapped into the current tab. In that |
67 case, an <code>onTabReplaced</code> event is fired. | 67 case, an <code>onTabReplaced</code> event is fired. |
68 </p> | 68 </p> |
69 | 69 |
70 <h2 id="relation_to_webRequest">Relation to webRequest events</h2> | 70 <h2 id="relation_to_webRequest">Relation to webRequest events</h2> |
71 <p> | 71 <p> |
72 There is no defined ordering between events of the <a | 72 There is no defined ordering between events of the <a |
73 href="webRequest.html">webRequest API</a> and the events of the | 73 href="webRequest">webRequest API</a> and the events of the |
74 webNavigation API. It is possible that webRequest events are still received for | 74 webNavigation API. It is possible that webRequest events are still received for |
75 frames that already started a new navigation, or that a navigation only | 75 frames that already started a new navigation, or that a navigation only |
76 proceeds after the network resources are already fully loaded. | 76 proceeds after the network resources are already fully loaded. |
77 </p> | 77 </p> |
78 <p> | 78 <p> |
79 In general, the webNavigation events are closely related to the navigation | 79 In general, the webNavigation events are closely related to the navigation |
80 state that is displayed in the UI, while the webRequest events correspond to | 80 state that is displayed in the UI, while the webRequest events correspond to |
81 the state of the network stack which is generally opaque to the user. | 81 the state of the network stack which is generally opaque to the user. |
82 </p> | 82 </p> |
83 | 83 |
84 <h2 id="tab_ids">A note about tab IDs</h2> | 84 <h2 id="tab_ids">A note about tab IDs</h2> |
85 <p> | 85 <p> |
86 Not all navigating tabs correspond to actual tabs in Chrome's UI, e.g., a tab | 86 Not all navigating tabs correspond to actual tabs in Chrome's UI, e.g., a tab |
87 that is being pre-rendered. Such tabs are not accessible via the | 87 that is being pre-rendered. Such tabs are not accessible via the |
88 <a href="tabs.html">tabs API</a> nor can you request information about them via | 88 <a href="tabs">tabs API</a> nor can you request information about them via |
89 <code>webNavigation.getFrame</code> or <code>webNavigation.getAllFrames</code>. | 89 <code>webNavigation.getFrame</code> or <code>webNavigation.getAllFrames</code>. |
90 Once such a tab is swapped in, an <code>onTabReplaced</code> event is fired and | 90 Once such a tab is swapped in, an <code>onTabReplaced</code> event is fired and |
91 they become accessible via these APIs. | 91 they become accessible via these APIs. |
92 </p> | 92 </p> |
93 | 93 |
94 <h2 id="timestamps">A note about timestamps</h2> | 94 <h2 id="timestamps">A note about timestamps</h2> |
95 <p> | 95 <p> |
96 It's important to note that some technical oddities in the OS's handling | 96 It's important to note that some technical oddities in the OS's handling |
97 of distinct Chrome processes can cause the clock to be skewed between the | 97 of distinct Chrome processes can cause the clock to be skewed between the |
98 browser itself and extension processes. That means that WebNavigation's events' | 98 browser itself and extension processes. That means that WebNavigation's events' |
(...skipping 20 matching lines...) Expand all Loading... |
119 case, you will receive repeated <code>onBeforeNavigate</code> and | 119 case, you will receive repeated <code>onBeforeNavigate</code> and |
120 <code>onErrorOccurred</code> events, until you receive the final | 120 <code>onErrorOccurred</code> events, until you receive the final |
121 <code>onCommitted</code> event. | 121 <code>onCommitted</code> event. |
122 </p> | 122 </p> |
123 | 123 |
124 <h2 id="transition_types">Transition types and qualifiers</h2> | 124 <h2 id="transition_types">Transition types and qualifiers</h2> |
125 <p> | 125 <p> |
126 The webNavigation API's <code>onCommitted</code> event has a | 126 The webNavigation API's <code>onCommitted</code> event has a |
127 <code>transitionType</code> and a <code>transitionQualifiers</code> property. | 127 <code>transitionType</code> and a <code>transitionQualifiers</code> property. |
128 The <em>transition type</em> is the same as used in the <a | 128 The <em>transition type</em> is the same as used in the <a |
129 href="history.html#transition_types">history API</a> describing how the browser | 129 href="history#transition_types">history API</a> describing how the browser |
130 navigated to this particular URL. In addition, several <em>transition | 130 navigated to this particular URL. In addition, several <em>transition |
131 qualifiers</em> can be returned that further define the navigation. | 131 qualifiers</em> can be returned that further define the navigation. |
132 </p> | 132 </p> |
133 <p> | 133 <p> |
134 The following transition qualifiers exist: | 134 The following transition qualifiers exist: |
135 </p> | 135 </p> |
136 <table> | 136 <table> |
137 <tr> | 137 <tr> |
138 <th> Transition qualifier </th> <th> Description </th> | 138 <th> Transition qualifier </th> <th> Description </th> |
139 </tr> | 139 </tr> |
(...skipping 17 matching lines...) Expand all Loading... |
157 The user used the Forward or Back button to initiate the navigation. | 157 The user used the Forward or Back button to initiate the navigation. |
158 </td> | 158 </td> |
159 </tr> | 159 </tr> |
160 <tr> | 160 <tr> |
161 <td>"from_address_bar"</td> | 161 <td>"from_address_bar"</td> |
162 <td> | 162 <td> |
163 The user initiated the navigation from the address bar (aka Omnibox). | 163 The user initiated the navigation from the address bar (aka Omnibox). |
164 </td> | 164 </td> |
165 </tr> | 165 </tr> |
166 </table> | 166 </table> |
OLD | NEW |