OLD | NEW |
1 <h1>Content Scripts</h1> | 1 <h1>Content Scripts</h1> |
2 | 2 |
3 | 3 |
4 <p> | 4 <p> |
5 Content scripts are JavaScript files that run in the context of web pages. | 5 Content scripts are JavaScript files that run in the context of web pages. |
6 By using the standard | 6 By using the standard |
7 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/">Document | 7 <a href="http://www.w3.org/TR/DOM-Level-2-HTML/">Document |
8 Object Model</a> (DOM), | 8 Object Model</a> (DOM), |
9 they can read details of the web pages the browser visits, | 9 they can read details of the web pages the browser visits, |
10 or make changes to them. | 10 or make changes to them. |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 var imgURL = <b>chrome.extension.getURL("images/myimage.png")</b>; | 426 var imgURL = <b>chrome.extension.getURL("images/myimage.png")</b>; |
427 document.getElementById("someImage").src = imgURL; | 427 document.getElementById("someImage").src = imgURL; |
428 </pre> | 428 </pre> |
429 | 429 |
430 <h2 id="examples"> Examples </h2> | 430 <h2 id="examples"> Examples </h2> |
431 | 431 |
432 <p> | 432 <p> |
433 You can find many | 433 You can find many |
434 <a href="samples.html#script">examples that use content scripts</a>. | 434 <a href="samples.html#script">examples that use content scripts</a>. |
435 A simple example of communication via messages is in the | 435 A simple example of communication via messages is in the |
436 <a href="samples.html#51a83d2ba3a32e3ff1bdb624d4e18ccec4c4038e">timer sample</a>
. | 436 <a href="samples.html#timer">Message Timer</a>. |
437 See <a href="samples.html#ede3c47b7757245be42ec33fd5ca63df4b490066">make_page_re
d</a> and | 437 See <a href="samples.html#page-redder">Page Redder</a> and |
438 <a href="samples.html#028eb5364924344029bcbe1d527f132fc72b34e5">email_this_page<
/a> | 438 <a href="samples.html#email-this-page-(by-google)">Email This Page</a> |
439 for examples of programmatic injection. | 439 for examples of programmatic injection. |
440 </p> | 440 </p> |
441 | 441 |
442 | 442 |
443 <h2 id="videos"> Videos </h2> | 443 <h2 id="videos"> Videos </h2> |
444 | 444 |
445 <p> | 445 <p> |
446 The following videos discuss concepts that are important for content scripts. | 446 The following videos discuss concepts that are important for content scripts. |
447 The first video describes content scripts and isolated worlds. | 447 The first video describes content scripts and isolated worlds. |
448 </p> | 448 </p> |
449 | 449 |
450 <p> | 450 <p> |
451 <iframe title="YouTube video player" width="640" height="390" src="//www.youtube
.com/embed/laLudeUmXHM?rel=0" frameborder="0" allowfullscreen></iframe> | 451 <iframe title="YouTube video player" width="640" height="390" src="//www.youtube
.com/embed/laLudeUmXHM?rel=0" frameborder="0" allowfullscreen></iframe> |
452 </p> | 452 </p> |
453 | 453 |
454 <p> | 454 <p> |
455 The next video describes message passing, | 455 The next video describes message passing, |
456 featuring an example of a content script | 456 featuring an example of a content script |
457 sending a request to its parent extension. | 457 sending a request to its parent extension. |
458 </p> | 458 </p> |
459 | 459 |
460 <p> | 460 <p> |
461 <iframe title="YouTube video player" width="640" height="390" src="//www.youtube
.com/embed/B4M_a7xejYI?rel=0" frameborder="0" allowfullscreen></iframe> | 461 <iframe title="YouTube video player" width="640" height="390" src="//www.youtube
.com/embed/B4M_a7xejYI?rel=0" frameborder="0" allowfullscreen></iframe> |
462 </p> | 462 </p> |
OLD | NEW |