| <html> | |
| <head><title>Simple links</title> | |
| <script> | |
| function simulateClick(target) { | |
| var evt = document.createEvent("MouseEvents"); | |
| evt.initMouseEvent("click", true, true, window, | |
| 0, 0, 0, 0, 0, false, false, | |
| false, false, 0, null); | |
| return target.dispatchEvent(evt); | |
| } | |
| function setPortNumber(portNumber) { | |
| var link = document.getElementById("cross_site_link"); | |
| link.setAttribute("href", "http://foo.com:" + portNumber + "/title2.html"); | |
| link = document.getElementById("cross_site_new_window_link"); | |
| link.setAttribute("href", "http://foo.com:" + portNumber + "/title2.html"); | |
| return true; | |
| } | |
| function clickSameSiteLink() { | |
| return simulateClick(document.getElementById("same_site_link")); | |
| } | |
| function clickSameSiteNewWindowLink() { | |
| return simulateClick(document.getElementById("same_site_new_window_link")); | |
| } | |
| function clickCrossSiteLink() { | |
| return simulateClick(document.getElementById("cross_site_link")); | |
| } | |
| function clickCrossSiteNewWindowLink() { | |
| return simulateClick(document.getElementById("cross_site_new_window_link")); | |
| } | |
| function clickViewSourceLink() { | |
| return simulateClick(document.getElementById("view_source_link")); | |
| } | |
| function clickDeadFileNewWindowLink() { | |
| return simulateClick(document.getElementById("dead_file_new_window_link")); | |
| } | |
| </script> | |
| </head> | |
| <a href="title2.html" id="same_site_link">same-site</a><br> | |
| <a href="http://foo.com/title2.html" id="cross_site_link">cross-site</a><br> | |
| <a href="view-source:about:blank" id="view_source_link">view-source:</a><br> | |
| <a href="title2.html" id="same_site_new_window_link" target="_blank">same-site new window</a> | |
| <a href="http://foo.com/title2.html" id="cross_site_new_window_link" target="_blank">cross-site new window</a> | |
| <a href="file://" id="dead_file_new_window_link" target="_blank">dead-file new window</a> | |
| </html> |