OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 * Copyright (c) 2015 The Chromium Authors. All rights reserved. Use of this |
| 3 * source code is governed by a BSD-style license that can be found in the |
| 4 * LICENSE file. |
| 5 --> |
| 6 <body> |
| 7 <iframe></iframe> |
| 8 <script> |
| 9 var frame = document.querySelector('iframe'); |
| 10 var port = null; |
| 11 var seenRequest = false; |
| 12 |
| 13 // Message arrives from <webview>. |
| 14 window.onmessage = function(e) { |
| 15 seenRequest = true; |
| 16 port = e.source; |
| 17 if (e.data == 'load-frames') { |
| 18 // Start loading the iframe. |
| 19 frame.src = 'child_frame.html'; |
| 20 } |
| 21 }; |
| 22 |
| 23 frame.onload = function() { |
| 24 if (seenRequest) { |
| 25 var childFrame = |
| 26 frame.contentWindow.document.getElementById('child-frame'); |
| 27 childFrame.onload = function() { |
| 28 port.postMessage('frames-loaded', '*'); |
| 29 }; |
| 30 // Load the nested iframe. |
| 31 childFrame.src = 'data:text/html,Hello'; |
| 32 } |
| 33 }; |
| 34 </script> |
| 35 </body> |
OLD | NEW |