Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7709863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:58:07+00:00 2026-06-01T00:58:07+00:00

I got strange behavior when I tried to test my navigator.geolocation.getCurrentPosition web page. Here

  • 0

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. Thanks before.

EDIT :
For this couple days I got some progress, 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”. Still unsolved, does anyone know how to solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:58:09+00:00Added an answer on June 1, 2026 at 12:58 am

    I simulated this problem and found that the success callback functions were only called when the html page was hosted on a web server and not when opened from a filesystem.

    To test I opened the file directly from my C: drive and it the callbacks didn’t work and then hosted the file on Internet Information Services (IIS) and the callbacks did work.

    <html>
    <body onload="detectLocation()">
    <!-- This html must be hosted on a server for navigator.geolocation callbacks to work -->
    
    <div id="status"></div>
    
    <script type="text/javascript">
    function detectLocation()
    {
      log("detectLocation() starting");
      if (navigator.geolocation)
      {
        log("navigator.geolocation is supported");
        navigator.geolocation.getCurrentPosition(geocodePosition, onError, { timeout: 30000 });
        navigator.geolocation.watchPosition(watchGeocodePosition);
      }
      else
      {
        log("navigator.geolocation not supported");
      }
    }
    function geocodePosition(){
        log("geocodePosition() starting");
    }
    
    function watchGeocodePosition(){
        log("watchGeocodePosition() starting");
    }
    
    function onError(error){
        log("error " + error.code);
    }
    function log(msg){
        document.getElementById("status").innerHTML = new Date() + " :: " + msg + "<br/>" + document.getElementById("status").innerHTML;
    }
    </script>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got a strange behavior from the mail function in php here is the
I've got some strange bug: when I open page first time in some browser
i've got a strange behavior or autospec. On autospec run i see in console
Ok, I got a strange one here and I want to know if any
I got a strange behavior when I used F#. When I use let binding
I've got a C++ gui project exhibiting some strange behavior. On my machine, the
I have a strange behavior of Rails 3.0.10. Got this application controller: app/controllers/application_controller.rb require
I got a strange behavior with an Eclipse installation: Even though all update sites
I've got a quite strange startup behavior for my application. The first time the
Really strange behaviour here. I've got a view with a scroll view inside, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.