itchio / itch.io

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

Device orientation permission can't be granted on iOS for web projects running in the browser #1669

Open gmarty opened 1 month ago

gmarty commented 1 month ago

Describe the bug For web projects running in the browser and hosted on itch.io, the device orientation permission is always denied on iOS.

Since iOS 13, the permission for using device orientation or device motion must be requested from a user interaction on the web page. Compare these 2 web pages, both embedded in an iframe and containing the same code:

Although both are placed inside an iframe, in the first example, the device orientation requestability is properly detected and a popup is displayed to enable it. In the case of itch.io, the permission is not detected and the popup is not displayed. I tried to force the permission request after a user interaction, but the permission is always "denied".

Please note that the iframe code is different on both pages:

Another difference is on the first example, the containing web page and the iframe source are both served from the same domain. This is not the case for itch.io. I don't know if it's related to the issue.

To Reproduce Steps to reproduce the behavior:

  1. Create a web page with JS content to request the device orientation API after a user interaction. For example, this code will do.
  2. Zip the file and upload it to an itch.io project with Kind of project set to HTML
  3. Check This file will be played in the browser
  4. Save the project
  5. Open the project on iOS
  6. Click on "Run game"

Expected behavior After a user interaction, the device orientation permission should be granted when requested.

Screenshots n/a

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.