Can I use Javascript to get the compass heading for iOS and Android?

前端 未结 3 1849
广开言路
广开言路 2020-11-30 04:32

Can I use Javascript in a cross-platform way to get the compass heading in iOS and Android (with Chrome), without using something like PhoneGap? I know iOS has DeviceOrienta

3条回答
  •  独厮守ぢ
    2020-11-30 05:05

    I believe you can use the "heading" field of the location object, from navigator.geolocation, please see here:

    https://developer.mozilla.org/en-US/docs/WebAPI/Using_geolocation

    I know no other way.

    Hope it helps, A.

提交回复
热议问题