Can I programmatically access a smartphone's sensors through the browser and JavaScript?

前端 未结 4 1546
梦如初夏
梦如初夏 2021-01-18 16:22

Is it possible for me to programmatically access a smartphone\'s sensors (e.g. accelerometer, compass, etc. on an Android or iPhone device) through a browser webpage and Jav

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-18 17:22

    The answer is both "yes" and "no". Each phone manufacturer/OS combination behaves as it sees fit here - for example, the GPS on an iPhone can be accessed, but the compass not:

    accessing iPhone compass with JavaScript

提交回复
热议问题