In my program, the user is interrupted after a certain time with a JavaScript game (snake game). The popup window (snake game) will close by itself when the user finishes. That code will be in the game.
I need the popup to be on top until the user finishes the game. Here, the user is able to avoid the popup (by clicking anywhere outside of the popup) and go back to the parent webpage. I need the user to keep playing the game until he/she finishes it. Is there a way I can do this?
Please only include suggestions with JavaScript.
<html>
<head>
<title>test</title>
<script>
function popup(){
var snakeGame
setInterval(function(){
snakeGame = window.open('snake.html', "_blank", "toolbar=0, titlebar=0, location=0, scrollbars=0, statusbar=0, status =yes, menubar=0, top=500, left=500, width=550, height=380").focus();
},5000);
}
</script>
</head>
<body>
<p>Web page content</p>
<body onload="popup()">
</body>
</html>