I try to take my location by using the share location html5 geolocation on the browser, when run in PC browser it appears a notif to allow access share location, while when I try on my smartphone browser chrome / firefox it does not work ... so my question..
whether when share location it only take Lat / Lot according from my IP ..
When share location why is not accurate, is taking the location of my card provider phone.
whether to use the GPS feature on our smartphone to take the location through the browser.
Related
Im building an app that requires location. Im serving my app locally via apache and have permitted chrome to give my virtual host access to location despite being served without ssl. My coordinates are coming out wrong as (6.5243793 3.3792057). Thats completely in another state on another part of my country. When I visit https://www.gps-coordinates.net/my-location, it gives the same location. But on firefox, https://www.gps-coordinates.net/my-location is giving me a more accurate location. On chrome mobile, im also getting a correct location Here is my code snippet
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(function(position){
var lat = position.coords.latitude,
long = position.coords.longitude;
initMap(lat,long);
// logging to console to find out why the map location is incorrect
console.log(lat+" "+long)
});
}
Can someone tell me whats going on, or better yet how to find out the exact location, probably through google maps api?
Chrome on mobile uses the GPS in your phone.
Chrome on desktop uses a service that estimates your location based on your IP address. This database is imprecise and often out of date. Firefox uses a different service, which works in the same way, but where your particular IP has a more accurate record.
I'm currently developing a mobile web page integrated with google map, and I need to include a my location button on the google map. in JavaScript i having something like this
navigator.geolocation.getCurrentPosition()
It is working in desktop browser, prompt me whether allot website access my location. In mobile browser it doesn't prompt me allow or deny, just throwing error says "User denied Geolocation".
Does anyone has come across this?
So you'll have to allow location sharing on an iPhone.
Go to Settings > General, then go to Reset > Reset Location & Privacy.
If you intend this to be used by other users you'll have to prompt for permission like Justinas stated.
I was wondering for my website, how accurate is the GeoLocation attribute of the navigator object in desktop web browsers? I guess on a mobile web browser this simply activates a GPS device so therefore is based on GPS signal at that time. However what about on a desktop? Does it have some means of determining its location and to what accuracy?
According to the spec:
Under the interface section:
The Geolocation object is used by scripts to programmatically determine the location information associated with the hosting device. The location information is acquired by applying a user-agent specific algorithm, creating a Position object, and populating that object with appropriate data accordingly.
Under the requirements section
6.2.8 The Geolocation API must be agnostic to the underlying sources of location information.
TL;DR: Depends on the browser's implementation. This could mean that it could use anything available on the device. It may even be possible to have "Mobile Provider" and "GPS" on a PC, since there are devices like Nokia Booklet 3G that has GPS and can be inserted a SIM.
I am using the geolocation functionality to track user's locations with javascript. More specifically, I am using navigator.geolocation.watchPosition. My site works fine. When I visit my site on my Android device it prompts if I would like to allow the site to track my location. I tap allow (as well as remember my preference).
After success with that I turned off location services on my phone and went back to the site. It didn't prompt me for permission again (since I told it to remember my preference last time but it didn't prompt me to turn on my location services either. Needless to say at that point my site never got any geolocation data from the browser.
My question: Is there some way to prompt the user to turn on their location services programatically? If I had not saved my security preference and it prompted me to allow again would it have turned on or asked me to turn on location services? I would hate to have to tell the user they need to go into their cell phone's preferences to enable it.
It's browser specific or to be more exact - application specific. What you could do is wait e.g. half a minute or a minute for the location and if it is not available show a warning to the user.
If I use navigator.geolocation.getCurrentPosition() in any web page and visit it using web browser of any mobile device with GPS, will it use GPS navigation?
And how it will determine location if device has no GPS?
The Geolocation API is agnostic of the underlying location information sources and therefore it is up to the browser (and device) to determine how the geolocation data is determined.
See here for more details on how Firefox gets the geo location information from Google, http://code.google.com/p/gears/wiki/GeolocationAPI
Short answer is: they keep a database with the location of all wifi hotspots (most likely collected by the same cars that take streetview footage) and uses that information to provide location data.