| OLD | NEW |
| 1 <div id="pageData-name" class="pageData">Background Pages</div> | 1 <div id="pageData-name" class="pageData">Background Pages</div> |
| 2 <div id="pageData-showTOC" class="pageData">true</div> | 2 <div id="pageData-showTOC" class="pageData">true</div> |
| 3 | 3 |
| 4 <p> | 4 <p> |
| 5 A common need for extensions is to have | 5 A common need for extensions is to have |
| 6 a single long-running script to manage some task or state. | 6 a single long-running script to manage some task or state. |
| 7 Background pages to the rescue. | 7 Background pages to the rescue. |
| 8 </p> | 8 </p> |
| 9 | 9 |
| 10 <p> | 10 <p> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 like this: | 34 like this: |
| 35 </p> | 35 </p> |
| 36 | 36 |
| 37 <pre>{ | 37 <pre>{ |
| 38 "name": "My extension", | 38 "name": "My extension", |
| 39 ... | 39 ... |
| 40 <b>"background_page": "background.html"</b>, | 40 <b>"background_page": "background.html"</b>, |
| 41 ... | 41 ... |
| 42 }</pre> | 42 }</pre> |
| 43 | 43 |
| 44 <p> | |
| 45 If you need the browser to start up early—so | |
| 46 you can display notifications, for example—then | |
| 47 you might also want to specify the | |
| 48 <a href="manifest.html#permissions">"background" permission</a>. | |
| 49 </p> | |
| 50 | |
| 51 | |
| 52 <h2>Details</h2> | 44 <h2>Details</h2> |
| 53 | 45 |
| 54 <p> | 46 <p> |
| 55 You can communicate between your various pages using direct script calls, | 47 You can communicate between your various pages using direct script calls, |
| 56 similar to how frames can communicate. | 48 similar to how frames can communicate. |
| 57 The <a href="extension.html#method-getViews"><code>chrome.extension.getViews()</
code></a> method | 49 The <a href="extension.html#method-getViews"><code>chrome.extension.getViews()</
code></a> method |
| 58 returns a list of window objects | 50 returns a list of window objects |
| 59 for every active page belonging to your extension, | 51 for every active page belonging to your extension, |
| 60 and the | 52 and the |
| 61 <a href="extension.html#method-getBackgroundPage"><code>chrome.extension.getBack
groundPage()</code></a> method | 53 <a href="extension.html#method-getBackgroundPage"><code>chrome.extension.getBack
groundPage()</code></a> method |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 <p> | 114 <p> |
| 123 Image here: | 115 Image here: |
| 124 </p> | 116 </p> |
| 125 | 117 |
| 126 <img id="target" src="white.png" width="640" height="480"> | 118 <img id="target" src="white.png" width="640" height="480"> |
| 127 | 119 |
| 128 </body> | 120 </body> |
| 129 </html> | 121 </html> |
| 130 </pre> | 122 </pre> |
| 131 | 123 |
| OLD | NEW |