My chrome always to call navigator.geolocation.getCurrentPosition

1,021 views
Skip to first unread message

John Hexis

unread,
Mar 15, 2012, 9:24:03 AM3/15/12
to Chromium-discuss
I got strange behavior when I tried to test my
"navigator.geolocation.getCurrentPosition" web page. Here is my
testing result and code:

my code:

function detectLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(geocodePosition,
onError, { timeout: 30000 });

navigator.geolocation.watchPosition(watchGeocodePosition);
} else {
onError();
}
}

this function was run when "body" onload event was called. I had tried
to change the timeout to 10000 and 20000, but I still got same result.
I also allowed crome and firefox to get my location.

result:
1. using chrome (v 17.0.963.79 m), result always went to onError
function when navigator.geolocation.getCurrentPosition was called.
2. using Firefox (v 10.0.2), result always went to onError function
when navigator.geolocation.getCurrentPosition was called.
3. using IE (v 9), result was fantastic, I got my current location.

can anyone help me in this strange situation? I really didn't have any
idea to solve this problem and I was in hurry on my project deadline.
Thank you.

PhistucK

unread,
Mar 27, 2012, 6:27:01 AM3/27/12
to jh.tec...@gmail.com, Chromium-discuss
1. What is the error that the onError function receives as an argument (I think)?
2. Perhaps FireFox/Chrome do not support the third attribute (on getCurrentPosition). Try to remove it and see if it helps.


PhistucK




--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
   http://groups.google.com/a/chromium.org/group/chromium-discuss

John Hexis

unread,
Mar 27, 2012, 9:39:57 AM3/27/12
to chromium...@chromium.org
the error code code is 2 with a message "Network location provider at 'https://maps.googleapis.com/maps/api/browserlocation/json?browser=chromium&sensor=true' : Response was malformed".
Start from last week my chrome could identify current position without hit an onError function anymore but I'm not sure this issue won't be repeated in future. I also didn't know why this issue coming up, I also didn't change anything in my code or my browser setting only an update from chrome once.

PhistucK

unread,
Mar 27, 2012, 9:42:51 AM3/27/12
to jh.tec...@gmail.com, chromium...@chromium.org
So it was probably just a server error. There is nothing you can do about it, anyway, I guess. You can file an issue when it happens again, after using Fiddler2 to get the actual request/response and attach them to the issue.

PhistucK



--

John Hexis

unread,
Mar 27, 2012, 9:56:05 AM3/27/12
to chromium...@chromium.org
I will send this issue if it occurs again, thanks for your reply and info about Fiddler2. I will use it often to trace unsolved issue like this in future.


On Thursday, 15 March 2012 20:24:03 UTC+7, John Hexis wrote:
Reply all
Reply to author
Forward
0 new messages