Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

186
Vistas
Remove everything from the page and replace it with the unity game onclick

The title is self-explanatory. I'm attempting to conceal a hidden href that, when clicked, erases everything on the page, leaving it blank for a second before inserting the unity game as the whole page.

Here's what I've got so far.

<!DOCTYPE html>
<html>
  <script>
    function wipeHTML() {
      document.documentElement.innerHTML = nothing; //NEED HELP HERE
      then wait 1 second
      document.documentElement.innerHTML = unity game loads; //NEED HELP HERE
    }

  </script>
  <!-- UNITY STUFF -->

  <head>
    <link rel="stylesheet" href="TemplateData/style.css">
    <script src="TemplateData/UnityProgress.js"></script>
    <script src="TemplateData/unityloader41.js"></script>
    <script>
      var gameInstance = UnityLoader.instantiate("gameContainer", "Build/slope.json", {
        onProgress: UnityProgress,
        Module: {
          onRuntimeInitialized: function() {
            UnityProgress(gameInstance, "complete")
          }
        }
      });

    </script>
  </head>

  <body style="margin: 0; overflow: hidden;">
    <div class="webgl-content">
      <div id="gameContainer" style="width: 100%; height: 100%; margin: 0;"></div>
    </div>
  </body>
  <!-- UNITY STUFF END -->
  <h1>
    <a href="javascript:wipeHTML">wipe everything</a>
  </h1>
  <div>
    <h1>
      hello
    </h1>
    <h3>
      erase me
    </h3>
  </div>

Tell me what I'm doing wrong! 🤷‍♂️

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

To clear the body of the page:

document.body = document.createElement("body");

To show the game, add a timeout, replace the console.log with the code to show the game.

setTimeout(() => console.log("load unity here"), 5e3)
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda