1 <HTML> 2 <!-- TODO(slightlyoff): Move to tests directory? --> 3 <HEAD> 4 <TITLE> Chrome Frame Test </TITLE> 5 <SCRIPT type="text/javascript"> 6 function msg(txt) { 7 try { 8 document.getElementById("my_text").innerHTML = txt; 9 } catch(e) { 10 alert("error"); 11 } 12 } 13 14 function GetChromeFrame() { 15 var chromeFrame = window.document.ChromeFrame 16 return chromeFrame; 17 } 18 19 function OnChromeFrameMessage(text) { 20 msg("In host: \r\nMessage from ChromeFrame: " + text); 21 22 var chromeFrame = GetChromeFrame(); 23 chromeFrame.PostMessageToFrame("OnHostMessage", "Hello from host"); 24 return "OK"; 25 } 26 27 function OnNavigate() { 28 var url = document.getElementById('inputurl'); 29 GetChromeFrame().src = url.value; 30 } 31 32 function OnFocus() { 33 msg("OnFocus"); 34 } 35 36 window.onload = function() { 37 var chromeFrame = GetChromeFrame(); 38 var url = location.href; 39 url = url.substr(0, url.lastIndexOf('/') + 1) + "frame_w_controls.html"; 40 chromeFrame.src = url; 41 42 try { 43 var cf = document.getElementById('ChromeFrame'); 44 cf.addEventListener("focus", OnFocus, true); 45 cf.addEventListener("blur", function() { msg('blur'); }, true); 46 msg("ready"); 47 } catch(e) { 48 alert("error"); 49 } 50 } 51 52 function setFocusToCf() { 53 var cf = document.getElementById('ChromeFrame'); 54 cf.focus(); 55 // alert(cf.hasFocus()); 56 return true; 57 } 58 59 </SCRIPT> 60 <style> 61 /* CSS magic to avoid the focus rect */ 62 object:focus { 63 outline: 0; 64 } 65 </style> 66 <!-- 67 object:focus { outline: none; } 68 :focus { outline: none } 69 a:focus { outline: 1px dotted invert } 70 --> 71 </HEAD> 72 <BODY> 73 Chrome Frame Test activex 74 <br><br> 75 <input id="inputurl" type="text" name="URL"> 76 <input type="submit" value="Navigate" onClick="OnNavigate();"> 77 <center> 78 <OBJECT ID="ChromeFrame" tabindex="0" 79 WIDTH="500" 80 HEIGHT="300" 81 CODEBASE="http://www.google.com" 82 CLASSID="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> 83 <!-- <PARAM NAME="BackColor" VALUE="100"> --> 84 <!-- <PARAM NAME="src" VALUE="file:///z:/code/debug/test.html"> --> 85 <embed ID="ChromeFramePlugin" WIDTH=500 HEIGHT=300 NAME="ChromeFrame" 86 SRC="http://www.google.com" TYPE="application/chromeframe"> 87 </embed> 88 </OBJECT> 89 <p>To test the focus: <input id="fake_edit" type="text" name="fake"></p> 90 <p><button onclick="return setFocusToCf();">SetFocusToCF</button></p> 91 <p> 92 Message:<br> 93 <pre><p id="my_text"></p></pre> 94 </p> 95 </center> 96 </BODY> 97 </HTML> 98