Monday, October 16, 2017

Checking if we're running with a user gesture

function isUserInteraction() {
  const detectionElement = window.document.createElement('audio');
  detectionElement.play();
  return !detectionElement.paused;
}