Accessing the iPhone Accelerometer with Javascript in iOS 13+

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…



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andy Kong

Hi! I’m Andy. I try to make things that haven’t been made before. Check out my personal projects at