itch.io icon indicating copy to clipboard operation
itch.io copied to clipboard

Allow web games to retrieve HTTP GET arguments

Open Ragzouken opened this issue 9 years ago • 11 comments
trafficstars

My usecase for this is I would like to make a puzzlescript style thing where the url contains an identifier used to download a saved project so users can share things via urls. I don't actually know if that is against itch.io security policies either...

Ragzouken avatar Aug 12 '16 10:08 Ragzouken

Do you need to read the window.location field directly or if you had a API to get parameters would it work? I'm thinking we'll expose an API that web games can use that can expose certain things about the parent page.

leafo avatar Aug 13 '16 20:08 leafo

Note that web games already have access to some itch-specific values (see 'Accessing the API key in HTML5 games' section in https://itch.io/docs/itch/integrating/manifest.html) it'd be nice if it was consistent :)

fasterthanlime avatar Aug 14 '16 11:08 fasterthanlime

I don't need direct access to window.location, though it would be good if I could also write/update the GET parameters as well as reading them (I guess I could instead write out the URL as a hyperlink in the game HTML page)

Ragzouken avatar Aug 15 '16 11:08 Ragzouken

here's an example of what i want from this feature: https://ragzouken.github.io/?id=deb8636d4f9ca5bbca67dfd088097ca2

i read that "id" value in the url, and i use "window.history.pushState" to update "id" in the url when the project is re-exported

Ragzouken avatar Jan 26 '17 13:01 Ragzouken

hey i am now working on yet another thing that would benefit from this, and wondering if it might be implemented in the forseeable future?

Ragzouken avatar Sep 23 '17 11:09 Ragzouken

I'm also looking for a way to read query strings from within my HTML5 game, is this feature still planned?

I've tried accessing "document.referrer" but it only returns the origin of the top-level URL; would it be feasible to change the Referrer-Policy so content hosted on your CDN can access the query string of the itch.io URL? Thanks a bunch.

fnnbrr avatar Mar 17 '21 15:03 fnnbrr

This would be super helpful

creikey avatar Jun 23 '21 23:06 creikey

I too would like to see the URL parameters accessible in HTML games, it would be very useful

hookmanuk avatar Sep 24 '21 14:09 hookmanuk

Hello, 8 years later I'm wondering if there is a way to do this yet. I'd love to use it to create invite codes so a user can share a link for online multiplayer.

djsell avatar Jul 09 '24 02:07 djsell

I'll see you all in 2050 when we finally get this very simple feature.

alyssafranczak avatar Aug 08 '24 20:08 alyssafranczak

My humble suggestion: while it would be awesome if we could access the whole querystring, I understand that might be considered a security issue. So, what about just ONE parameter (say, ?pass=) which could simply be passed as-is to the iframe URL, allowing game developers to use it as they see fit (eg. urlencoded JSON) without endangering anything and without requiring anything more than a single change to the template that includes the iframe?

pgcd avatar Jan 14 '25 18:01 pgcd