itch.io Spring Selects Series A
On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

MrMasterbit

6
Posts
1
Topics
1
Followers
A member registered Jan 28, 2017 · View creator page →

Creator of

Recent community posts

I finally managed to get what I wanted. It was not possible for me to access a remote leaderboard server from within a WebGL game hosted on itch.io. This is because of the Cross-Origin restrictions mentioned earlier. Itch.io does not supply HTTP-headers that allow these requests.

However, one can upload a html file including an iframe to a server where you host your WebGL game. Once I had that, I had to take care of some problems:

1. First I could not enter fullscreen mode from within the iframe. You have to allow this with a special attribute in your iframe tag ("allowfullscreen").

2. Although the iframe worked in Firefox, Chrome still blocked it, because the new WebGL target URL was not https. So I had to get an SSL certificate.

After that it was only a matter of styling weired iframe margins and setting up a little DB for the leader board. If someone has the same problem, he can just have a look at my source code on my ASTROPUZZ game or contact me.

It would just be great if itch.io could provide a localhost mini API where one could just save some key-value pairs. Providing a Access-Control-Allow-Origin http header would also be great. One could argue that this is not a good idea due to security concerns. But giving the possibility of iframes with virtually unlimited data flow while prohibiting Cross-Origin requests seems unnecessary to me, right?

Hey @toastio! Thanks for your detailed answer. So some requests seem to be permitted at least. I will try that later for my game.

nice addictive game.. i only got 36 :).. can't find a link to your ld41 page for ratings

hey.. nice game :). does anyone else has the problem, that one gets kicked back to itch.io game browsing when trying to enter a highscore name?

Found a funny exploit :).. just quickly press up all the time. I always win :P

Hi,

I tried to find some information about, if it is possible to somehow store leaderboard data on itch.io. As I understand cross-domain requests are prohibited for safety reasons by all common browsers. I would just love to save a name and a value server-side for my HTML game, so that other players can see a list of highscores.

Does someone know, if this is possible?

Best regards
Lukas