Created
August 3, 2016 11:48
-
-
Save andrijac/f17ff6a1267fd18cd73c7abd296bff47 to your computer and use it in GitHub Desktop.
Interacting with new 'window' instance (test)
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