Jump to content
mywebacc

Error of geolocation

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?

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...