How to Beat Wordle Every Day! An Easy Cheat Using Browser Console
2 ways to quickly solve the viral puzzle
Originally posted on My Medium.
Unlike my usual articles, this is not about deep learning or computer vision. This is about a popular web game called Wordle.
Since I have been seeing many people sharing their daily Wordle results on social media recently, it makes me curious to look into the game (or more accurately, the code logic of the game) and I found a way to cheat at it.
Disclaimer
Using this cheat is going to make the game much less fun. If you are trying to enjoy the game and simply like to discover strategies, please do not use this cheat, and regard this article as a how-programmers-see-a-viral-web-game blog.
Method 1
- In your desktop browser, press F12 to open the developer tools
- Go to the Console tab
- Paste the following code into the console and press Enter on your keyboard:
(new window.wordle.bundle.GameApp).solution
Method 2
- In your desktop browser, press F12 to open the developer tools
- Go to the Application tab
- Click the URL under Storage > Local Storage
How I Discovered
When we fill a row with a 5-letter word and press Enter, there are no AJAX calls triggered in the Network tab.
This tells us that it does not need to ask the server for the answer when it is checking whether you are correct. Therefore, it means that the answer is already stored in the client’s browser.
We can then add an event listener to Mouse click in the Debugger and see which line of code is triggered when we click ENTER on the virtual keyboard (which will trigger answer checking).
Now I know that the answer word is stored in a variable called this.solution
. By searching solution
throughout the source code, I found that solution
is a property in the window.wordle.bundle.GameApp
object.
Thus, what we need to do is to instantiate it using new window.wordle.bundle.GameApp
, and then we can obtain the answer property by .solution
.
This is just a sharing of how we can exploit web apps through dev tools in a web browser. It is not encouraged to play the game in this way. After all, you will have more fun when you guess the right word on your own.
Please note that Wordle might change its source codes or policy such that this line of cheat code doesn’t work anymore. But with the same rationale and thinking steps, you can discover the hacks of virtually any prevailing web game yourself.
Happy Hacking!