| OLD | NEW |
| 1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: | 1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: |
| 2 1) The <head> information in this page is significant, should be uniform | 2 1) The <head> information in this page is significant, should be uniform |
| 3 across api docs and should be edited only with knowledge of the | 3 across api docs and should be edited only with knowledge of the |
| 4 templating mechanism. | 4 templating mechanism. |
| 5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a | 5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a |
| 6 browser, it will be re-generated from the template, json schema and | 6 browser, it will be re-generated from the template, json schema and |
| 7 authored overview content. | 7 authored overview content. |
| 8 4) The <body>.innerHTML is also generated by an offline step so that this | 8 4) The <body>.innerHTML is also generated by an offline step so that this |
| 9 page may easily be indexed by search engines. | 9 page may easily be indexed by search engines. |
| 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> | 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 </div> | 218 </div> |
| 219 </ol> | 219 </ol> |
| 220 </div> | 220 </div> |
| 221 <!-- /TABLE OF CONTENTS --> | 221 <!-- /TABLE OF CONTENTS --> |
| 222 | 222 |
| 223 <!-- STATIC CONTENT PLACEHOLDER --> | 223 <!-- STATIC CONTENT PLACEHOLDER --> |
| 224 <div id="static"><div id="pageData-title" class="pageData">Content Scrip
ts</div> | 224 <div id="static"><div id="pageData-title" class="pageData">Content Scrip
ts</div> |
| 225 <div id="pageData-showTOC" class="pageData">true</div> | 225 <div id="pageData-showTOC" class="pageData">true</div> |
| 226 | 226 |
| 227 <p> | 227 <p> |
| 228 Content Scripts are JavaScript files that run in the context of web pages. | 228 Content scripts are JavaScript files that run in the context of web pages. |
| 229 By using the standard | 229 By using the standard |
| 230 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/">Document | 230 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/">Document |
| 231 Object Model</a> (DOM), | 231 Object Model</a> (DOM), |
| 232 they can read details of the web pages the browser visits, | 232 they can read details of the web pages the browser visits, |
| 233 or make changes to them. | 233 or make changes to them. |
| 234 </p> | 234 </p> |
| 235 | 235 |
| 236 <p> | 236 <p> |
| 237 Here are some examples of what content scripts can do: | 237 Here are some examples of what content scripts can do: |
| 238 </p> | 238 </p> |
| 239 | 239 |
| 240 <ul> | 240 <ul> |
| 241 <li>Find unlinked URLs in web pages and convert them into hyperlinks | 241 <li>Find unlinked URLs in web pages and convert them into hyperlinks |
| 242 </li><li>Increase the font size to make text more legible | 242 </li><li>Increase the font size to make text more legible |
| 243 </li><li>Find and process <a href="http://microformats.org/">microformat</a> d
ata in the DOM | 243 </li><li>Find and process <a href="http://microformats.org/">microformat</a> d
ata in the DOM |
| 244 </li></ul> | 244 </li></ul> |
| 245 | 245 |
| 246 <p> | 246 <p> |
| 247 However, content scripts have some limitations. | 247 However, content scripts have some limitations. |
| 248 They <b>cannot use</b>: | 248 They <b>cannot</b>: |
| 249 </p> | 249 </p> |
| 250 | 250 |
| 251 <ul> | 251 <ul> |
| 252 <li> | 252 <li> |
| 253 chrome.* APIs | 253 Use chrome.* APIs |
| 254 (except for parts of | 254 (except for parts of |
| 255 <a href="extension.html"><code>chrome.extension</code></a>) | 255 <a href="extension.html"><code>chrome.extension</code></a>) |
| 256 </li> | 256 </li> |
| 257 <li> | 257 <li> |
| 258 variables or functions defined by their extension's pages | 258 Use variables or functions defined by their extension's pages |
| 259 </li> | 259 </li> |
| 260 <li> | 260 <li> |
| 261 variables or functions defined by web pages or by other content scripts | 261 Use variables or functions defined by web pages or by other content scripts |
| 262 </li> |
| 263 <li> |
| 264 Make cross-site XMLHttpRequests |
| 262 </li> | 265 </li> |
| 263 </ul> | 266 </ul> |
| 264 | 267 |
| 265 <p> | 268 <p> |
| 266 These limitations aren't as bad as they sound. | 269 These limitations aren't as bad as they sound. |
| 267 Content scripts can <em>indirectly</em> use the chrome.* APIs, | 270 Content scripts can <em>indirectly</em> use the chrome.* APIs, |
| 268 get access to extension data, | 271 get access to extension data, |
| 269 and request extension actions | 272 and request extension actions |
| 270 by exchanging <a href="#messaging">messages</a> | 273 by exchanging <a href="#messaging">messages</a> |
| 271 with their parent extension. | 274 with their parent extension. |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 urchinTracker(); | 648 urchinTracker(); |
| 646 } | 649 } |
| 647 catch(e) {/* urchinTracker not available. */} | 650 catch(e) {/* urchinTracker not available. */} |
| 648 </script> | 651 </script> |
| 649 <!-- end analytics --> | 652 <!-- end analytics --> |
| 650 | 653 |
| 651 </div> <!-- /pageFooter --> | 654 </div> <!-- /pageFooter --> |
| 652 </div> <!-- /container --> | 655 </div> <!-- /container --> |
| 653 </body></html> | 656 </body></html> |
| 654 | 657 |
| OLD | NEW |