How to close WebGL App?

I’ve got my game loaded in a web page div. However, I need to control when it loads & when it closes.

I can start the game on command fine. However, what is the proper way to end it? Application.Quit is ignored apparently.

I tried just simply disposing but it ended up aww snapping the browser.

There are a few functions on:


But it doesn’t seem like you can actually call, quit, exit or abort…

Bit of a hack, but iFrame does the trick.

Rename index.html to game.html.

create a new index.html.

<!DOCTYPE html>
<html lang="en-us">

  <meta charset="utf-8">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>Game Container</title>
    body {
      margin: 0;
      padding: 0;
      background-color: white;
      overflow: hidden;

    #canvas {
      width: auto;
      height: 100vh;
      display: block;

    function removeElement(element) {
      element && element.parentNode && element.parentNode.removeChild(element);

    function onPlayClicked() {
      document.getElementById('iframeDiv').src = "./game.html";

    function onQuitClicked() {
      document.getElementById('iframeDiv').src = "";

  <div id="controls" style="position: absolute;">
    <button style="position: relative;" onclick="onPlayClicked()">Play</button>
    <button style="position: relative;" onclick="onQuitClicked()">Quit</button>
  <iframe id="iframeDiv" style="width: 100vw; height: 100vh; z-index: 0;" src=""></iframe>


Should be able to Play/Reload/Quit the game… Also disables audio.