ondevicemotion in Chrome desktop returns true

Posted by Martin Klasson on Stack Overflow See other posts from Stack Overflow or by Martin Klasson
Published on 2013-11-19T09:40:19Z Indexed on 2014/05/30 21:27 UTC
Read the original article Hit count: 164

Filed under:

I am using a "shake" function from github - and it has a detection that is browser-based javascript.

//feature detect
this.hasDeviceMotion = 'ondevicemotion' in window;

This though yields true even on Chrome on OS X. It feels strange, since I am not willing to shake my monitor on my desktop.

Safari on OS X gives me "false" in return when testing.

I have searched but not been able to find out why Chrome decided to take this path. It bugs me.

Is there a better way to make this detection? Not all "mobile devices" has shake as well.. or does not let the browser have that capability, as it does not seem to work in windows phones.

© Stack Overflow or respective owner

Related posts about google-chrome