blogccasion

Play the Chrome dino game on your Nintendo Switch

I have landed an article over on web.dev that talks about the Gamepad API. One piece of information from this article that our editorial board was not comfortable with having in there was instructions on how to play the Chrome dino game on a Nintendo Switch. So, here you go with the steps right here on my private blog instead.

The hands of a person playing the Chrome dino game on a Nintendo Switch.
Press any of the Nintendo Switch's buttons to play!

The Nintendo Switch contains a hidden browser, which serves for logging in to Wi-Fi networks behind a captive portal. The browser is pretty barebones and does not have a URL bar, but, once you have navigated to a page, it is fully usable. When doing a connection test in system settings, the Switch will detect that the captive portal is present and display an error for it when the response for http://conntest.nintendowifi.net/ does not include the X-Organization: Nintendo HTTP header. I can make creative use of this by pointing the Switch to a DNS server that simulates a captive portal that then redirects to a search engine.

  1. Go to System Settings and then Internet Settings and find the Wi-Fi network that your Switch is connected to. Tap Change Settings.
  2. Find the section with the DNS Settings and add 45.55.142.122 as a new Primary DNS. Note that this DNS server is not operated by me but a third-party, so proceed at your own risk.
  3. Save the settings and then tap Connect to This Network.
  4. The Switch will tell you that Registration is required to use this network. Tap Next.
  5. On the page that opens, make your way to Google.
  6. Search for "chrome dino tomayac". This should lead you to https://github.com/tomayac/chrome-dino-gamepad.
  7. On the right-hand side in the About section, find the link to https://tomayac.github.io/chrome-dino-gamepad/. Enjoy!
  8. 🚨 For regular Switch online services to work again, turn your DNS settings back to Automatic. Conveniently, the Switch remembers previous manual DNS settings, so you can easily toggle between Automatic and Manual.

For the Chrome dino gamepad demo to work, I have ripped out the Chrome dino game from the core Chromium project (updating an earlier effort by Arnelle Ballane), placed it on a standalone site, extended the existing gamepad API implementation by adding ducking and vibration effects, created a full screen mode, and Mehul Satardekar contributed a dark mode implementation. Happy gaming!

You can also play Chrome dino with your gamepad on this very site. The source code is available on GitHub. Check out the gamepad polling implementation in trex-runner.js and note how it is emulating key presses.