How to hack chrome’s T-rex game with Java script.

Most of us have seen the dreaded “No Internet” error message on Google Chrome. You can actually turn this screen into a fun, dino-themed endless runner game and, even better, hack it to where your dinosaur becomes invincible.

If you don’t have an internet connection, then you don’t have to do anything special to play. Just enter any URL in the Google Chrome address bar, and you’ll see this screen.

No internet page

If you do have an internet connection, you can access this page without cutting the connection. Type chrome://dino in the address bar, and it will take you there.

For the tutorial you don’t need any prior coding experience or knowledge, all you need to do is follow the instructions.

The final output will be looking like this

Lets go……….

  1. Right click the page and click on inspect option
inspect option

Now a tool box will be displayed like the image below

inspect element tool

2. Now you need the select the console option which will be next to the elements option

console image

Now lets start writing to write the code.

3. Once in the “Console” tab, paste the following command and then press the “Enter” key:

var original = Runner.prototype.gamveOver

Don’t worry if you don’t know what this does, I will explain it in a minute.

4. Now enter this command

Runner.prototype.gameOver = function (){}

On the next line, f (){} will appear after pressing the “Enter” key.

Here’s what happens now. When the game is over (i.e., when you hit an object), Runner.prototype.gameOver() is called and the action is triggered. In this case, you’ll hear a sound, the game stops, and a Game Over message appears. That’s without our code.

What our code does is replaces the gameOver function with an empty function. That means that instead of hearing the sound, the game stopping, and the message appearing, nothing happens. You just keep running.

Test it out. Close DevTools, and press the space bar to start playing the game.

5. With this command you can increase the speed of the t-rex.

Runner.instance_.setSpeed(100)

You can replace 100 with any number you want.

As you can see, the dinosaur is unaffected by the cacti or flying creatures. Mission accomplished.

Now, let’s say you’ve been playing for 25 minutes and you want to stop the game and record your high score. You’ll need a way to end the game, which can no longer be done by running into a cactus.

Remember the first code we entered? That stored the normal gameOver function in the original variable. That means we can now execute this command to use the normal gameOver function:

Runner.prototype.gameOver = original

That’s it, now we have learned how to hack chrome’s t-rex game.

You can watch the video below if you want clear explanation.

Contact me:

email: ahnashwin1305@gmail.com