javascript - Accurate compass mobile website -


i want make compass in browser (mobile website, not native applicaton). purpose have button "save current location localstorage" , when click on button save latitude & longitude of current location in localstorage of browser.

then later when example 1 kilometre location saved in localstorage (for example on parking) have compass arrow headed location in localstorage.

what save location in localstorage. don't how can make compass headed location?

this now:

enter image description here

can me?

thanks in advance!

now have direction of phone.

you have 2 points (x1,y1) , (x2,y2). angle between 2 points in js is:

var angle = math.atan2(y2 - y1, x2 - x1); 

Comments