OLD | NEW |
1 <div id="pageData-name" class="pageData">Embed Content</div> | 1 <div id="pageData-name" class="pageData">Embed Content</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 The <a href="app_architecture.html#security">packaged apps security model</a> di
sallows | 5 The <a href="app_architecture.html#security">packaged apps security model</a> di
sallows |
6 external content in iframes and | 6 external content in iframes and |
7 the use of inline scripting and <code>eval()</code>. | 7 the use of inline scripting and <code>eval()</code>. |
8 You can override these restrictions, | 8 You can override these restrictions, |
9 but your external content must be isolated from the app. | 9 but your external content must be isolated from the app. |
10 </p> | 10 </p> |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 <p> | 174 <p> |
175 Just like any other app pages, | 175 Just like any other app pages, |
176 you can create a window that the sandboxed page opens in. | 176 you can create a window that the sandboxed page opens in. |
177 Here's a sample that creates two windows, | 177 Here's a sample that creates two windows, |
178 one for the main app window that isn't sandboxed, | 178 one for the main app window that isn't sandboxed, |
179 and one for the sandboxed page: | 179 and one for the sandboxed page: |
180 </p> | 180 </p> |
181 | 181 |
182 <pre> | 182 <pre> |
183 chrome.experimental.app.onLaunched.addListener(function() { | 183 chrome.experimental.app.onLaunched.addListener(function() { |
184 chrome.appWindow.create('window.html', { | 184 chrome.app.window.create('window.html', { |
185 'width': 400, | 185 'width': 400, |
186 'height': 400, | 186 'height': 400, |
187 'left': 0, | 187 'left': 0, |
188 'top': 0 | 188 'top': 0 |
189 }); | 189 }); |
190 | 190 |
191 chrome.appWindow.create('sandboxed.html', { | 191 chrome.app.window.create('sandboxed.html', { |
192 'width': 400, | 192 'width': 400, |
193 'height': 400, | 193 'height': 400, |
194 'left': 400, | 194 'left': 400, |
195 'top': 0 | 195 'top': 0 |
196 }); | 196 }); |
197 }); | 197 }); |
198 </pre> | 198 </pre> |
199 | 199 |
200 <h3>Embedding a sandboxed page in an app page</h3> | 200 <h3>Embedding a sandboxed page in an app page</h3> |
201 | 201 |
(...skipping 29 matching lines...) Expand all Loading... |
231 between your app and sandboxed content. | 231 between your app and sandboxed content. |
232 Here's a sample background script | 232 Here's a sample background script |
233 that posts a message to the sandboxed page it | 233 that posts a message to the sandboxed page it |
234 opens: | 234 opens: |
235 </p> | 235 </p> |
236 | 236 |
237 <pre> | 237 <pre> |
238 var myWin = null; | 238 var myWin = null; |
239 | 239 |
240 chrome.experimental.app.onLaunched.addListener(function() { | 240 chrome.experimental.app.onLaunched.addListener(function() { |
241 chrome.appWindow.create('sandboxed.html', { | 241 chrome.app.window.create('sandboxed.html', { |
242 'width': 400, | 242 'width': 400, |
243 'height': 400 | 243 'height': 400 |
244 }, function(win) { | 244 }, function(win) { |
245 myWin = win; | 245 myWin = win; |
246 myWin.postMessage('Just wanted to say hey.', '*'); | 246 myWin.postMessage('Just wanted to say hey.', '*'); |
247 }); | 247 }); |
248 }); | 248 }); |
249 </pre> | 249 </pre> |
250 | 250 |
251 <p> | 251 <p> |
(...skipping 22 matching lines...) Expand all Loading... |
274 <pre> | 274 <pre> |
275 var messageHandler = function(e) { | 275 var messageHandler = function(e) { |
276 console.log('Background script says hello.', e.data); | 276 console.log('Background script says hello.', e.data); |
277 }; | 277 }; |
278 | 278 |
279 window.addEventListener('message', messageHandler); | 279 window.addEventListener('message', messageHandler); |
280 </pre> | 280 </pre> |
281 | 281 |
282 <p class="backtotop"><a href="#top">Back to top</a></p> | 282 <p class="backtotop"><a href="#top">Back to top</a></p> |
283 | 283 |
OLD | NEW |