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 |
44 <h2>Details</h2> | 52 <h2>Details</h2> |
45 | 53 |
46 <p> | 54 <p> |
47 You can communicate between your various pages using direct script calls, | 55 You can communicate between your various pages using direct script calls, |
48 similar to how frames can communicate. | 56 similar to how frames can communicate. |
49 The <a href="extension.html#method-getViews"><code>chrome.extension.getViews()</
code></a> method | 57 The <a href="extension.html#method-getViews"><code>chrome.extension.getViews()</
code></a> method |
50 returns a list of window objects | 58 returns a list of window objects |
51 for every active page belonging to your extension, | 59 for every active page belonging to your extension, |
52 and the | 60 and the |
53 <a href="extension.html#method-getBackgroundPage"><code>chrome.extension.getBack
groundPage()</code></a> method | 61 <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... |
114 <p> | 122 <p> |
115 Image here: | 123 Image here: |
116 </p> | 124 </p> |
117 | 125 |
118 <img id="target" src="white.png" width="640" height="480"> | 126 <img id="target" src="white.png" width="640" height="480"> |
119 | 127 |
120 </body> | 128 </body> |
121 </html> | 129 </html> |
122 </pre> | 130 </pre> |
123 | 131 |
OLD | NEW |