OLD | NEW |
1 <h1>External Content</h1> | 1 <h1>External Content</h1> |
2 | 2 |
3 | 3 |
4 <p> | 4 <p> |
5 The <a href="app_architecture#security">Chrome Apps security model</a> disallows | 5 The <a href="app_architecture#security">Chrome Apps security model</a> disallows |
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 <h3 id="opening_sandbox">Opening a sandboxed page in a window</h3> | 171 <h3 id="opening_sandbox">Opening a sandboxed page in a window</h3> |
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 <p class="warning"> | 181 <p class="note"> |
182 NOTE: | 182 NOTE: |
183 <a href="https://code.google.com/p/chromium/issues/detail?id=154662">issue 15466
2</a> | 183 A sandboxed window will not have access to the chrome.app APIs. If a |
184 is a bug when using sandbox pages to create windows. | 184 callback is provided to app.window.create it will be run, but will not have |
185 The effect is that an error "Uncaught TypeError: Cannot call method | 185 the sandboxed window provided to it. |
186 'initializeAppWindow' of undefined" is output to the developer console | |
187 and that the app.window.create call does not call the callback function | |
188 with a window object. However, the sandbox page is created as a new window. | |
189 </p> | 186 </p> |
190 | 187 |
191 <pre data-filename="background.js"> | 188 <pre data-filename="background.js"> |
192 chrome.app.runtime.onLaunched.addListener(function() { | 189 chrome.app.runtime.onLaunched.addListener(function() { |
193 chrome.app.window.create('window.html', { | 190 chrome.app.window.create('window.html', { |
194 'bounds': { | 191 'bounds': { |
195 'width': 400, | 192 'width': 400, |
196 'height': 400, | 193 'height': 400, |
197 'left': 0, | 194 'left': 0, |
198 'top': 0 | 195 'top': 0 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 294 |
298 window.addEventListener('message', messageHandler); | 295 window.addEventListener('message', messageHandler); |
299 </pre> | 296 </pre> |
300 | 297 |
301 <p> | 298 <p> |
302 For more details, check out the | 299 For more details, check out the |
303 <a href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/
sandbox">sandbox</a> sample. | 300 <a href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/
sandbox">sandbox</a> sample. |
304 </p> | 301 </p> |
305 | 302 |
306 <p class="backtotop"><a href="#top">Back to top</a></p> | 303 <p class="backtotop"><a href="#top">Back to top</a></p> |
OLD | NEW |