Accessing the iPhone Accelerometer with Javascript in iOS 13-16+

Andy Kong
6 min readNov 16, 2020

TL;DR: Demo here. Hit the button at the top to start.

I recently tried out a bunch of different Javascript accelerometer demos that claimed to access the IMU sensor in-browser. It was usually a simple demo: dots rolling across a screen due to gravity, or perspective shifting a 3D scene based on your orientation. However, none of these demos worked at all — no popup asking about permissions or anything. What gives?

In iOS 13, Apple added an option under Safari to allow webpages to request…

--

--