OLD | NEW |
1 <h2 id="manifest">Manifest</h2> | 1 <h2 id="manifest">Manifest</h2> |
2 | 2 |
3 <p> | 3 <p> |
4 You must declare the "declarativeWebRequest" permission in the | 4 You must declare the "declarativeWebRequest" permission in the |
5 <a href="manifest.html">extension manifest</a> to use this API, | 5 <a href="manifest.html">extension manifest</a> to use this API, |
6 along with <a href="declare_permissions.html">host permissions</a>. | 6 along with <a href="declare_permissions.html">host permissions</a>. |
7 </p> | 7 </p> |
8 | 8 |
9 <pre>{ | 9 <pre>{ |
10 "name": "My extension", | 10 "name": "My extension", |
11 ... | 11 ... |
12 <b> "permissions": [ | 12 <b> "permissions": [ |
13 "declarativeWebRequest", | 13 "declarativeWebRequest", |
14 "*://*.google.com" | 14 "*://*/*" |
15 ]</b>, | 15 ]</b>, |
16 ... | 16 ... |
17 }</pre> | 17 }</pre> |
18 | 18 |
19 <p> | 19 <p> |
20 Note that certain types of non-sensitive actions do not require host | 20 Note that certain types of non-sensitive actions do not require host |
21 permissions: | 21 permissions: |
22 <ul> | 22 <ul> |
23 <li><code>CancelRequest</code> | 23 <li><code>CancelRequest</code> |
24 <li><code>IgnoreRules</code> | 24 <li><code>IgnoreRules</code> |
25 <li><code>RedirectToEmptyDocument</code> | 25 <li><code>RedirectToEmptyDocument</code> |
26 <li><code>RedirectToTransparentImage</code> | 26 <li><code>RedirectToTransparentImage</code> |
27 </ul> | 27 </ul> |
28 </p> | 28 </p> |
29 <p> | 29 <p> |
30 The <code>SendMessageToExtension</code> action requires host permissions | 30 The <code>SendMessageToExtension</code> action requires host permissions |
31 for any hosts whose network requests you want to trigger a message. | 31 for any hosts whose network requests you want to trigger a message. |
32 </p> | 32 </p> |
33 <p> | 33 <p> |
34 All other actions require host permissions to all URLs. | 34 All other actions require host permissions to all URLs. |
35 </p> | 35 </p> |
36 <p> | 36 <p> |
37 As an example, if <code>"*://*.google.com"</code> is the only host permission an | 37 As an example, if <code>"*://*.google.com/*"</code> is the only host permission |
38 extension has, than such an extension may set up a rule to | 38 an extension has, than such an extension may set up a rule to |
39 <ul> | 39 <ul> |
40 <li> cancel a request to "http://www.google.com" or "http://anything.else.com" | 40 <li> cancel a request to "http://www.google.com" or "http://anything.else.com" |
41 <li> send a message when navigating to "http://www.google.com" but not to | 41 <li> send a message when navigating to "http://www.google.com" but not to |
42 "http://something.else.com" | 42 "http://something.else.com" |
43 </ul> | 43 </ul> |
44 The extension cannot set up a rule to redirect "http://www.google.com" to | 44 The extension cannot set up a rule to redirect "http://www.google.com" to |
45 "http://mail.google.com". | 45 "http://mail.google.com". |
46 </p> | 46 </p> |
47 | 47 |
48 <h2 id="rules">Rules</h2> | 48 <h2 id="rules">Rules</h2> |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 chrome.declarativeWebRequest.onRequest.addRules([rule1, rule2]); | 240 chrome.declarativeWebRequest.onRequest.addRules([rule1, rule2]); |
241 </pre> | 241 </pre> |
242 | 242 |
243 <p> | 243 <p> |
244 It is important to recognize that the <code>IgnoreRules</code> action is not | 244 It is important to recognize that the <code>IgnoreRules</code> action is not |
245 persisted across <a href="#evaluation">request stages</a>. All conditions of | 245 persisted across <a href="#evaluation">request stages</a>. All conditions of |
246 all rules are evaluated at each stage of a web request. If an | 246 all rules are evaluated at each stage of a web request. If an |
247 <code>IgnoreRules</code> action is executed, it applies only to other actions | 247 <code>IgnoreRules</code> action is executed, it applies only to other actions |
248 that are executed for the same web request in the same stage. | 248 that are executed for the same web request in the same stage. |
249 </p> | 249 </p> |
OLD | NEW |