OLD | NEW |
(Empty) | |
| 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 <object id="ChromeFrame" width="500" height ="300" |
| 45 codebase="http://www.google.com" |
| 46 classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> |
| 47 <param name="src" value="postmessage_basic_frame.html"> |
| 48 <param name="onload" value="onChromeFrameLoaded();"> |
| 49 <param name="onloaderror" value="onNavigationFailed();"> |
| 50 <param name="onmessage" value="onChromeFrameMessage(arguments[0]);"> |
| 51 <embed id="ChromeFramePlugin" name="ChromeFrame" |
| 52 width="500" height="500" |
| 53 src="postmessage_basic_frame.html" |
| 54 type="application/chromeframe" |
| 55 onload="onChromeFrameLoaded();" |
| 56 onloaderror="onNavigationFailed();" |
| 57 onmessage="onChromeFrameMessage(arguments[0]);"> |
| 58 </embed> |
| 59 </object> |
| 60 <br> |
| 61 <br> |
| 62 <p>Test for PostMessage from the host browser to ChromeFrame and back</p> |
| 63 <button onclick="document.ChromeFrame.postMessage('Message from button');"> |
| 64 Send message to frame</button> |
| 65 <div id="statusPanel" style="border: 1px solid red; width: 100%"> |
| 66 Test running.... |
| 67 </div> |
| 68 </body> |
| 69 </html> |
OLD | NEW |