Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

185
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda