Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Pass the query parameters down to iframe

A topic by matte created Sep 20, 2024 Views: 962 Replies: 4
Viewing posts 1 to 5
(+8)

It would be really cool to be able to pass some data to HTML5 games through query parameters, and it seems to be close to a one-line change (just append these when generating iframe src URL).

That would help put the game or tool into a certain state, for example to:

  • immediately join certain private room in online game
  • start from specific level
  • share the save between multiple devices and players

My personal use-case would be a cross-device game that should be played on both PC and smartphone, with an easy connection via QR-code with session ID encoded in the itch.io game URL. Currently that would require me to host the game somewhere else, or players to establish the connection manually.

There is a workaround of using the iframe src URL that itch generates as the base URL to use with query parameters, but there is no guarantee that the URL won't change, it skips the itch page of the game, and degrades the user experience.

(1 edit) (+1)

Hello, I have the exact same issue. I'm using the fragment part of the URL to embed a lobby code (my-game.com/#12353)

On Itch this fragment is neither read nor written to, probably because of the iframe. How can I go around this limitation?

If this cannot be solved I might be unable to submit my game to itch entirely and will have to self-host it.

I too suffered from lack of this feature. If your goal is only to create lobbies, you can share links directly to the nested iframe, like this: https://html-classic.itch.zone/html/15886391/index.html

Unfortunately, these links are unstable between game versions, so they are not suitable for long-term publication.

They also do not redirect to the game page itself, which makes it very hard to track activity for / the user is unable to buy the game or post comments for instance. Not good :(

Passing the fragment would also enable using the Itch game page as the OAuth callback URL, allowing to circumvent the lack of Itch API object in browsers runtime. (This would require the player to click on a scary "Login using Itch" button and allowing permissions, but it's better than the current nothing that forces us to host outside of Itch...)