Skip to main content

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

iframe on itch is missing permissions?

A topic by Rebel Egg Games created Feb 03, 2023 Views: 502 Replies: 2
Viewing posts 1 to 3

Hello!

I've got a problem, which I think(?) might be on Itch side.

I have my game available in WebGL - when I want to use the clipboard for copy/paste game save, I get following error in console:

 "Clipboard API has been blocked because of a permissions policy applied to the current document. See https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-p... for more details."

It seems that the "iframe" in which the game is played do not have certain flags set-up.

The main reason I've enabled export/import save via string was that players have a problem with how saves are stored in browser - they sometimes lose progression.

Did anyone have a similar problem? Is there anything I can do?

For Itch it would be just adding those flags to the iframe if I'm correct - should take one minute.

Please help :<

So... the only "workaround" I found out is to allow the player to click a button, which will launch the game directly, in a new window, outside iframe.
However this approach is messy and confuses save data storage in the browser.

I cannot access the elements of the "iframe", because of "security" so there is no way for me to add clipboard permissions - the only way to do that would be to use code that could look malicious and I do not want to do this.

I'm not a web dev however, so perhaps I'm missing something here?

Ok, I've solved the problem by using a different approach - since accessing clipboard from iframe was not allowed.

If anyone ever has a similar problem - just save data as a file / load from file.

You can do this by a bit of JavaScript, which will call the typical "save as..." / "open..." window.

Feel free to reach me in case you need help ;)

This topic has been auto-archived and can no longer be posted in because there haven't been any posts in a while.