1 <html> 2 3 <head><title>Click nocontent link</title> 4 <script> 5 function simulateClick(target) { 6 var evt = document.createEvent("MouseEvents"); 7 evt.initMouseEvent("click", true, true, window, 8 0, 0, 0, 0, 0, false, false, 9 false, false, 0, null); 10 11 return target.dispatchEvent(evt); 12 } 13 14 function clickNoContentTargetedLink() { 15 return simulateClick(document.getElementById("nocontent_targeted_link")); 16 } 17 18 function clickNoContentScriptedTargetedLink() { 19 return simulateClick(document.getElementById( 20 "nocontent_scripted_targeted_link")); 21 } 22 23 var w; 24 function modifyNewWindow() { 25 // Grab a reference to the existing foo window and modify its content. 26 w = window.open("", "foo"); 27 w.document.body.innerHTML += "Modified"; 28 29 // Also modify the title to give the test a notification to listen for. 30 // Use a timeout so that the didAccessInitialDocument notification arrives 31 // first. 32 setTimeout('w.document.title = "Modified Title"'); 33 return true; 34 } 35 </script> 36 </head> 37 38 <a href="/nocontent" id="nocontent_targeted_link" target="foo"> 39 /nocontent target=foo</a><br> 40 <button onclick="modifyNewWindow()">Modify New Window</button><br> 41 42 <a href="/nocontent" id="nocontent_scripted_targeted_link" target="foo" 43 onclick="modifyNewWindow()"> 44 /nocontent scripted target=foo</a><br> 45 46 </html> 47