Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / [SOLVED] Feature Request: html5 parameters

Author
Message
Prime
User Offline
Joined: 15th Jun 2022
Location:
Posted: 25th Jul 2022 20:28
Is there a way to get the url used to access an Html5 app, in order to get any arguments that might have been passed in? Some websites will pass in a userid or auth token in the url so you can get information about the current player

The author of this post has marked a post as an answer.

Go to answer

Carharttguy
6
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 26th Jul 2022 11:13
It's not possible at the moment.

A possible, yet cumbersome workaround would be some Javascript on the page:
In AppGameKit, listen to a socket connection (creates a listening websocket connection in HTML5)
In JS, try to connect to the websocket server in AppGameKit, post arguments, close connection.

Not beautiful, elegant, but it should work.
Prime
User Offline
Joined: 15th Jun 2022
Location:
Posted: 26th Jul 2022 21:53
I don't know if you'd consider this more or less beautiful or elegant than what you proposed, but I took a hint from https://forum.thegamecreators.com/thread/227556#msg2664274 and changed the function in question to the following



which on itch.io gives me "https://v6p9d9t4.ssl.hwcdn.net/html/6237442/index.html" but I believe that if any arguments were passed to index.html that they would be appended to this string. Now that I think about it, it might be better to change the next function instead so that a read of a cookie named "args" always returns window.location.href without taking up cookie space.
Prime
User Offline
Joined: 15th Jun 2022
Location:
Posted: 26th Jul 2022 22:02
This post has been marked by the post author as the answer.
The following change has identical results, and I do like it better for the reason I stated earlier.

Prime
User Offline
Joined: 15th Jun 2022
Location:
Posted: 26th Jul 2022 23:25
On the subject of editing AGKPlayer.js, at first I thought I could keep a modified version of the file and copy it in as needed but it seems to not work. For anybody who modifies AGKPlayer.js do you use any kind of automation, or do you manually unminify, change the code, save, and then possibly re-minify every time you test?
Prime
User Offline
Joined: 15th Jun 2022
Location:
Posted: 26th Jul 2022 23:29
Confirmed that this technique works at game jolt

Carharttguy
6
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 28th Jul 2022 11:48
Using a cookie is indeed an easier solution than passing it over an socket connection. Well done!

Login to post a reply

Server time is: 2022-08-09 07:46:56
Your offset time is: 2022-08-09 07:46:56