Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (35 sloc) 958 Bytes

Geofencing Explained

What's All This About?

TODO(slightlyoff): explain motivation for feature here.

Registering A Geofence

Registering for a geofence is straightforward:

<!DOCTYPE html>
<!-- -->

      navigator.serviceWorker.whenReady().then(function(sw) {
        // TODO
  <body> ... </body>

Handling Geofence Events

Location notification happens from the Service Worker context via the new ... event.

// sw.js
self.<...> = function(event) {
  // TODO

Removing Geofences



  • Since Service Workers are a requirement for Geofencing, and since Service Workers are limited to HTTPS origins, sites served without encryption will always fail to register for fences.
  • SW event handlers aren't allowed to run forever.