Skip to content

Instantly share code, notes, and snippets.

@pjb3
Created April 2, 2014 15:28
Show Gist options
  • Save pjb3/9936421 to your computer and use it in GitHub Desktop.
Save pjb3/9936421 to your computer and use it in GitHub Desktop.
How to fake your location in a browser
@navigator.geolocation.watchPosition = (callback) ->
setInterval(->
callback
coords:
latitude: 39.286031201326416,
longitude: -76.61204230156727
, 5000)
@allthesignals
Copy link

Thanks!

Plain JavaScript version:

this.navigator.geolocation.watchPosition = function(callback) {
  return setInterval(function() {
    return callback({
      coords: {
        latitude: 39.286031201326416,
        longitude: -76.61204230156727
      }
    });
  }, 5000);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment