Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!