Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
js
README.md
index.html

README.md

README

Geomock.js

The Geomock project is a little plaything that allows you to mock your location in the browser. Activating Geomock pops up a window with a Google Map. The blue bouncing icon represents your current position. Clicking anywhere else on the map produces a pink icon, which represents your mocked location.

Geomock overrides your browser's native getCurrentPosition() and watchPosition() calls with its own faked versions, so your code doesn't have to change.

The returned mock position object has the basic properties that you would expect from a successful return from the original functions, ie. stuff like latitude and longitude are present.

How to use:

  1. Include geomock.js

    <script src="js/geomock.js"></script>

  2. Call geomock.go()

    <input type="button" onclick="javascript:geomock.go()" value="Geomock Go">

  3. Click somewhere on the map to select the location you want to appear to be at

  4. Your code should report you being at that location instead

Note

Geomock.js only affects calls to getCurrentPosition()/watchPosition() after geomock.go() has been called.

TODO

  • How do we make it take effect on calls to watchPosition() that are already in progress?
Something went wrong with that request. Please try again.