<script> if (location.protocol != 'https:') { location.href = 'https:' + window.location.href.substring(window.location.protocol.length); } function requestT () { if (typeof(DeviceMotionEvent) !== 'undefined' && typeof(DeviceMotionEvent.requestPermission) === 'function') { DeviceMotionEvent.requestPermission() .then(response => { alert('Orientation tracking '+ response); if (response == 'granted') { window.addEventListener('devicemotion', (e) => { document.getElementById('request').style.visibility='hidden'; }) } }) .catch(console.error) }else { alert('DeviceMotionEvent is not defined'); } } document.getElementById('request').onclick = requestT;