何らかの理由で、Galaxy S3 を使用している場合、デバイス モーションに関する HTML5Rocks のサンプル デモを使用して、携帯電話のハードウェアから加速度値を取得できます。
デモ: http://www.html5rocks.com/en/tutorials/device/orientation/devicemotionsample.html
しかし、自分の Web サイトでコードを動作させることができないようです。次のようにする必要があります。
if((window.DeviceMotionEvent)||('listenForDeviceMovement'in window))
{window.addEventListener('devicemotion',deviceMotionHandler3,false);
function deviceMotionHandler3(eventData){var
acceleration=eventData.accelerationIncludingGravity;
...
このコードが上記の Web サイトで機能するのに、空白の HTML ページにコピーすると機能しない理由はありますか?