Jump to content

Error of geolocation


mywebacc

Recommended Posts

I can't use the function of geolocation in my desktop. Browsers are Firefox and Google Chrome. OS is window xp.

 

I click the button to get positon and also click "share position info"

 

The result:

Firefox alert "Unknown error acquiring position"

Google Chrome alert "Javascript notice: User denied Geolocation"

 

 

 

<!doctype html><html> <head> <meta charset="utf-8"> <title>Geolocation test</title> </head> <body> <p>Your latitude:<span id = "latitude">000</span></p> <p>Your longitude:<span id = "longitude">000</span></p> <p><button onClick="getPosition()">click for your position</button></p> <script> function getPosition(){ if(navigator.geolocation){ navigator.geolocation.getCurrentPosition(showPosition, errorMessage); } else{ alert("this browser does not support geolocation"); } } function showPosition(position){ document.getElementById("latitude").innerHTML = position.coords.latitude; document.getElementById("longitude").innerHTML = position.coords.longitude; } function errorMessage(error){ alert(error.message); } </script> </body></html>

 

 

 

I am trying to solve the problem by searching Google. I got some information in the following link: https://bugzilla.mozilla.org/show_bug.cgi?id=822967

 

Some people said that desktop can't use geolocation. Is it right? Any solution?

Link to comment
Share on other sites

 

Some people said that desktop can't use geolocation. Is it right? Any solution?

 

 

The files need to be loaded onto a server. Geolocation won't work if the html file is merely on your pc.

Link to comment
Share on other sites

woo... I try it in my iphone.

 

Upload the script to server first.

 

If I use GPS. It's work. I can check the latitude and longitude. (browser: Safari)

I also try it in my tablet. It's work. (browser: unknown and firefox)

However, my desktop is not work. (browser:Chrome and firefox) Somebody said desktop can use ip address to estimate latitude and longitude. But it seems to be wrong.

Link to comment
Share on other sites

If the device has GPS it should work. If the device is a laptop that doesn't have GPS then it returns an estimate based on your IP address that is usually several miles away.

Link to comment
Share on other sites

Your desktop browser might also be automatically set to deny geolocation requests.

 

But I click "share my position". I am not quite sure, but I think I do not deny the goelocation requests.

 

Do you have any idea to accept the geolocation requests?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...