Reputation: 546
I am writing a field services HTML5 application that runs on the Google Chrome web browser on Windows laptops that have a GPS chips in them. I am using the html5 geolocation api to get the user's location. This works fine as long as the user has an ip address (either from wifi or a wired network connection).
However, when the laptop does not have a network connection, geolocation fails even though the laptop has a GPS chip. I am worried that the browser is not smart enough to use the GPS chip and is instead always wanting to call Google's network geolocation service, which fails if there is no network. Anyone know if that's the case?
Is there a way to make Google Chrome geolocation work on a laptop that has a GPS chip but no network connection? Seems silly that it doesn't work!
Upvotes: 3
Views: 2399
Reputation: 2204
The solution I found was
Write a tiny dotnet console app that return the location from windows location api. The windows location api respect the accuracy of the installed gps and return it when available.
Then I wrote a chrome extension with permission to run this dotnet app and return the result.
My webapp can check if the extension is installed and trigger a location request.
I'm not sure it is a better approach than the gpsgate local server, anyway it was great way to solve it without any third party apps.
It worked great on dozens of windows Panasonic toughbooks tablets.
Upvotes: 0
Reputation: 6468
Although not ideal, you could use a 3rd party desktop app to write location data to a file on disk. If the file is written to the web folder, this could be read using javascript. Windows gps loggins software: http://gpsgate.com/support/nmea_logger
Upvotes: 2
Reputation: 6468
Have you tried setting the enableHighAccuracy property to true?
navigator.geolocation.getCurrentPosition(
processGeolocation,
// Optional settings below
geolocationError,
{
timeout: 0,
enableHighAccuracy: true,
maximumAge: Infinity
}
);
Upvotes: 0