Sergio
Sergio

Reputation: 73

How does the Chrome Geolocation Sensor work?

There is an option within the Chrome dev tools which allows you to change your ubication (More Tools > Sensors). How does it work internally? Does it add an extra HTTP header indicating the GEO coordinates?

Upvotes: 2

Views: 778

Answers (1)

Jon
Jon

Reputation: 492

Yes, it changes the cookie that's sent with the request:

This is the cookie for Mountain View (California, Google HQ):

Cookie: UULE=a+cm9sZToxIHByb2R1Y2VyOjEyIHByb3ZlbmFuY2U6NiB0aW1lc3RhbXA6MTUyMjc1NDM1MDc1MjAwMCBsYXRsbmd7bGF0aXR1ZGVfZTc6MzczODYwNTIwIGxvbmdpdHVkZV9lNzotMTIyMDgzODUxMH0gcmFkaXVzOjkzMDAw

Discard the UULE=a+ and what you're left with is a Base64 encoded string. Decoding that becomes:

role:1 producer:12 provenance:6 timestamp:1522754350752000 latlng{latitude_e7:373860520 longitude_e7:-1220838510} radius:93000

Within that is the longitude and latitude, but I'm not sure what the other parts refer to. Guessing the radius is the radius from the centre of that long/lat (in metres?).

Hope that helps.

Upvotes: 3

Related Questions