I have the following code (listed below). In short, when a user clicks the button "All On" it will open a popup window with yahoo.com. I want the window to remain open for 3 seconds, then automatically close with no additional interaction from the user.
Although the popup opens exactly as desired, I get this error when the close attempts to execute.
script438: Object doesn't support property or method 'close' lights.html (11,31)
I am not a coder and cannot figure this out. Ultimately, this will primarily run on Safari iOS. And, obviously, the yahoo link will be replaced with a specific IP address. Thank you.
<!DOCTYPE HTML>
<html>
<head>
<title>Light Control Example</title>
<script type="text/javascript">
function allOn(){
var win = 'http://www.yahoo.com';
open(win,'1366002941508','width=1,height=1,left=5,top=3');
setTimeout(function() { win.close();}, 3000);
}
</script>
</head>
<body>
<h1>Lights Example</h1>
<input type=submit value="ALL ON" onclick="allOn();" />
</body>
</html>