Created
April 21, 2016 13:41
-
-
Save andrijac/cf57bac269a6d2592dea81b59b42e79c to your computer and use it in GitHub Desktop.
quick demo for controlling remote window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<button onclick="myFunction()">Open</button> | |
<button onclick="gotoUrl()">goto</button> | |
<button onclick="focusWin()">focus</button> | |
<script> | |
(function(win){ | |
var w; | |
function myFunction() { | |
w = win.open("http://www.yahoo.com"); | |
} | |
function gotoUrl() { | |
w.location.href = "http://google.com"; | |
} | |
function focusWin() { | |
w.focus(); | |
} | |
win.myFunction = myFunction; | |
win.gotoUrl = gotoUrl; | |
win.focusWin = focusWin; | |
})(window); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment