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.html#security">Chrome Apps security model</a> disa
llows | 5 The <a href="app_architecture.html#security">Chrome Apps security model</a> disa
llows |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 Fetch the remote URL into the app and serve its contents as a <code>blob:</code> | 54 Fetch the remote URL into the app and serve its contents as a <code>blob:</code> |
55 URL: | 55 URL: |
56 </p> | 56 </p> |
57 | 57 |
58 <pre> | 58 <pre> |
59 var xhr = new XMLHttpRequest(); | 59 var xhr = new XMLHttpRequest(); |
60 xhr.open('GET', 'https://supersweetdomainbutnotcspfriendly.com/image.png', true)
; | 60 xhr.open('GET', 'https://supersweetdomainbutnotcspfriendly.com/image.png', true)
; |
61 xhr.responseType = 'blob'; | 61 xhr.responseType = 'blob'; |
62 xhr.onload = function(e) { | 62 xhr.onload = function(e) { |
63 var img = document.createElement('img'); | 63 var img = document.createElement('img'); |
64 img.src = window.webkitURL.createObjectURL(this.response); | 64 img.src = window.URL.createObjectURL(this.response); |
65 document.body.appendChild(img); | 65 document.body.appendChild(img); |
66 }; | 66 }; |
67 | 67 |
68 xhr.send(); | 68 xhr.send(); |
69 </pre> | 69 </pre> |
70 | 70 |
71 <p>You may want to <a href="offline_apps.html#saving-locally">save</a> | 71 <p>You may want to <a href="offline_apps.html#saving-locally">save</a> |
72 these resources locally, so that they are available offline.</p> | 72 these resources locally, so that they are available offline.</p> |
73 | 73 |
74 <h2 id="webview">Embed external web pages</h2> | 74 <h2 id="webview">Embed external web pages</h2> |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 290 |
291 <pre data-filename="sandboxed.html"> | 291 <pre data-filename="sandboxed.html"> |
292 var messageHandler = function(e) { | 292 var messageHandler = function(e) { |
293 console.log('Background script says hello.', e.data); | 293 console.log('Background script says hello.', e.data); |
294 }; | 294 }; |
295 | 295 |
296 window.addEventListener('message', messageHandler); | 296 window.addEventListener('message', messageHandler); |
297 </pre> | 297 </pre> |
298 | 298 |
299 <p class="backtotop"><a href="#top">Back to top</a></p> | 299 <p class="backtotop"><a href="#top">Back to top</a></p> |
OLD | NEW |