| OLD | NEW |
| 1 <h1>Embed Content</h1> | 1 <h1>Embed Content</h1> |
| 2 | 2 |
| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 <p> | 173 <p> |
| 174 Just like any other app pages, | 174 Just like any other app pages, |
| 175 you can create a window that the sandboxed page opens in. | 175 you can create a window that the sandboxed page opens in. |
| 176 Here's a sample that creates two windows, | 176 Here's a sample that creates two windows, |
| 177 one for the main app window that isn't sandboxed, | 177 one for the main app window that isn't sandboxed, |
| 178 and one for the sandboxed page: | 178 and one for the sandboxed page: |
| 179 </p> | 179 </p> |
| 180 | 180 |
| 181 <pre> | 181 <pre> |
| 182 chrome.experimental.app.onLaunched.addListener(function() { | 182 chrome.app.runtime.onLaunched.addListener(function() { |
| 183 chrome.app.window.create('window.html', { | 183 chrome.app.window.create('window.html', { |
| 184 'width': 400, | 184 'width': 400, |
| 185 'height': 400, | 185 'height': 400, |
| 186 'left': 0, | 186 'left': 0, |
| 187 'top': 0 | 187 'top': 0 |
| 188 }); | 188 }); |
| 189 | 189 |
| 190 chrome.app.window.create('sandboxed.html', { | 190 chrome.app.window.create('sandboxed.html', { |
| 191 'width': 400, | 191 'width': 400, |
| 192 'height': 400, | 192 'height': 400, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 You can use <code>postMessage</code> to communicate | 229 You can use <code>postMessage</code> to communicate |
| 230 between your app and sandboxed content. | 230 between your app and sandboxed content. |
| 231 Here's a sample background script | 231 Here's a sample background script |
| 232 that posts a message to the sandboxed page it | 232 that posts a message to the sandboxed page it |
| 233 opens: | 233 opens: |
| 234 </p> | 234 </p> |
| 235 | 235 |
| 236 <pre> | 236 <pre> |
| 237 var myWin = null; | 237 var myWin = null; |
| 238 | 238 |
| 239 chrome.experimental.app.onLaunched.addListener(function() { | 239 chrome.app.runtime.onLaunched.addListener(function() { |
| 240 chrome.app.window.create('sandboxed.html', { | 240 chrome.app.window.create('sandboxed.html', { |
| 241 'width': 400, | 241 'width': 400, |
| 242 'height': 400 | 242 'height': 400 |
| 243 }, function(win) { | 243 }, function(win) { |
| 244 myWin = win; | 244 myWin = win; |
| 245 myWin.postMessage('Just wanted to say hey.', '*'); | 245 myWin.postMessage('Just wanted to say hey.', '*'); |
| 246 }); | 246 }); |
| 247 }); | 247 }); |
| 248 </pre> | 248 </pre> |
| 249 | 249 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 272 | 272 |
| 273 <pre> | 273 <pre> |
| 274 var messageHandler = function(e) { | 274 var messageHandler = function(e) { |
| 275 console.log('Background script says hello.', e.data); | 275 console.log('Background script says hello.', e.data); |
| 276 }; | 276 }; |
| 277 | 277 |
| 278 window.addEventListener('message', messageHandler); | 278 window.addEventListener('message', messageHandler); |
| 279 </pre> | 279 </pre> |
| 280 | 280 |
| 281 <p class="backtotop"><a href="#top">Back to top</a></p> | 281 <p class="backtotop"><a href="#top">Back to top</a></p> |
| OLD | NEW |