According to the readme, Chrome for Android should support cross-origin iframes when allow="gyroscope; accelerometer" is set on the iframe. That's not the case, though, it appears the iframe is not able to access the features it needs.
In Safari on iOS, postMessage is used to send the motion events, so here it works fine in a cross-origin iframe.
Here's an example - it's simply the example from here put on a separate domain to get cross-origin:
https://cimmerse-iframe-tester.glitch.me/
Since devicemotion is only used on iOS, and Chrome uses the RelativeOrientationSensor API, I can't fix the problem by simply also passing the motion events via postMessage in Chrome also. The documentation on https://developers.google.com/web/updates/2017/09/sensors-for-the-web doesn't specifically mention what features/permisssions need to be set on the iframe for the RelativeOrientationSensor API cross-origin, but it appears that allow="gyroscope; accelerometer" is not enough.
What's the fix?
According to the readme, Chrome for Android should support cross-origin iframes when
allow="gyroscope; accelerometer"is set on the iframe. That's not the case, though, it appears the iframe is not able to access the features it needs.In Safari on iOS,
postMessageis used to send the motion events, so here it works fine in a cross-origin iframe.Here's an example - it's simply the example from here put on a separate domain to get cross-origin:
https://cimmerse-iframe-tester.glitch.me/
Since
devicemotionis only used on iOS, and Chrome uses theRelativeOrientationSensorAPI, I can't fix the problem by simply also passing the motion events viapostMessagein Chrome also. The documentation on https://developers.google.com/web/updates/2017/09/sensors-for-the-web doesn't specifically mention what features/permisssions need to be set on the iframe for theRelativeOrientationSensorAPI cross-origin, but it appears thatallow="gyroscope; accelerometer"is not enough.What's the fix?