Home | History | Annotate | Download | only in data
      1 <!-- saved from url=(0014)about:internet -->
      2 <html>
      3 <!-- This page is meant to load inside the host browser like IE/FF -->
      4   <head>
      5     <script type="text/javascript" src="chrome_frame_tester_helpers.js">
      6     </script>
      7     <script type="text/javascript">
      8       var post_message_reply_received = 0;
      9 
     10       function onChromeFrameLoaded() {
     11         appendStatus('Chrome frame loaded...');
     12         document.ChromeFrame.postMessage('Hello from host');
     13         setTimeout(onPostMessageFailure, 10000);
     14       }
     15 
     16       function onNavigationFailed(msg) {
     17         onFailure('PostMessage', 1, 'ChromeFrame Navigation failed: ' + msg);
     18       }
     19 
     20       function onChromeFrameMessage(evt) {
     21         try {
     22           var d = new String(evt.data);
     23           appendStatus('Message: ' + d);
     24           if (d == 'Hello from ChromeFrame') {
     25             post_message_reply_received = 1;
     26             onSuccess('PostMessage', 1);
     27           } else {
     28             onFailure('PostMessage', 1, 'unexpected data');
     29           }
     30         } catch (e) {
     31           onFailure('PostMessage', 1, 'exception in onChromeFrameMessage');
     32         }
     33       }
     34 
     35       function onPostMessageFailure() {
     36         if (!post_message_reply_received) {
     37           onFailure('PostMessage', 1, 'Did not receive reply back from frame');
     38         }
     39       }
     40     </script>
     41   </head>
     42 
     43   <body>
     44     <span id="ChromeFrameSpan"></span>
     45     <script type="text/javascript">
     46 insertControl(
     47     "ChromeFrameSpan",
     48     { "src": "postmessage_basic_frame.html",
     49       "eventHandlers": { "onload": "onChromeFrameLoaded();",
     50                          "onloaderror": "onNavigationFailed();",
     51                          "onmessage": "onChromeFrameMessage(arguments[0]);" },
     52       "objectAttributes": { "height": "300" }
     53     });
     54     </script>
     55     <br>
     56     <br>
     57     <p>Test for PostMessage from the host browser to ChromeFrame and back</p>
     58     <button onclick="document.ChromeFrame.postMessage('Message from button');">
     59       Send message to frame</button>
     60     <div id="statusPanel" style="border: 1px solid red; width: 100%">
     61       Test running....
     62     </div>
     63   </body>
     64 </html>
     65