Skip to content

Instantly share code, notes, and snippets.

@librevlad
Forked from mittsh/fake-location.js
Created February 7, 2020 18:29
Show Gist options
  • Save librevlad/9c374b92211825b57c3f6011ad092463 to your computer and use it in GitHub Desktop.
Save librevlad/9c374b92211825b57c3f6011ad092463 to your computer and use it in GitHub Desktop.
Simulate a fake location in browser API
navigator.geolocation.getCurrentPosition = (fn) => {
setTimeout(() => {
fn({
coords: {
accuracy: 40,
altitude: null,
altitudeAccuracy: null,
heading: null,
latitude: 13.705848,
longitude: 100.622798,
speed: null,
},
timestamp: Date.now(),
})
}, 2912)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment