itchio / itch.io

:bug: Public itch.io issues tracker and documentation - use support instead for private information!
https://itch.io/support
240 stars 25 forks source link

Allow web games to retrieve HTTP GET arguments #514

Open Ragzouken opened 8 years ago

Ragzouken commented 8 years ago

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...

leafo commented 8 years ago

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.

fasterthanlime commented 8 years ago

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 :)

Ragzouken commented 8 years ago

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 commented 7 years ago

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 commented 6 years ago

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?

fnnbrr commented 3 years ago

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.

creikey commented 3 years ago

This would be super helpful

hookmanuk commented 2 years ago

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

djsell commented 2 months ago

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.

alyssafranczak commented 1 month ago

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