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

  • Home
  • SEARCH
  • 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 6042805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:49:50+00:00 2026-05-23T06:49:50+00:00

When using geolocation API’s navigator.geolocation.getCurrentPosition() how to deal with a negative response? It says

  • 0

When using geolocation API’s navigator.geolocation.getCurrentPosition() how to deal with a negative response?

It says that the second callback function is called when there is an error. However when user chooses not to reveal his location by cancelling the request that function is never fired.

It seems that getCurrentPosition() waits for an answer indefinitely. (at least in Firefox 4)

How can I know when user presses cancel (or no etc.)

Any ideas?

  • 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-05-23T06:49:51+00:00Added an answer on May 23, 2026 at 6:49 am

    See edit below
    You are correct, the error handler should fire when a user denies the location request. The error object passed into the error handler should contain an error code and message letting you know the user denied the request. However, I’m not seeing this in FF4 when selecting the option Not Now from the location request dialogue.

    In Chrome, the API/callbacks work exactly as expected, but in Chrome there is no 3rd option.

    EDIT
    Ahhh okay I found a little quirk in the behavior of this in FF4. In normal mode (not private browsing), the user will be presented 3 options:

    • Always share
    • Never share
    • Not Now

    Never share triggers the error handler correctly, but Not Now does not.

    What does this mean and how to handle it?

    Well, it looks like if the user hits Not Now, you aren’t going to get a response. Therefore, I would set a timeout which checks a flag that would be set by one of the handlers. If this flag is not set (meaning the handlers didn’t fire in the allotted time), you can do one of two things:

    1. Assume that the user denied the request (even though the denial was temporary)
    2. You can ask the user for permission again (via the same call) and the user will be presented with the dialog again.

    Option 2 is probably bad usability (and annoying), so it is probably best to assume they denied temporarily and ask them again (politely!) the next time they visit the site.


    I created a JsFiddle to play around with this API:

    http://jsfiddle.net/7yYpn/11/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the navigator.geolocation.getCurrentPosition(function) api in firefox 3.6. When i try to call this
Using C#, I need a class called User that has a username, password, active
I am using the HTML5 Geolocation API to find the longitude and the latitude
I am using http://code.google.com/apis/maps/documentation/geocoding/ api from google to get geolocation based on address. I
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Is there a library out there that will get you your approximate location using
I have a list of links that all go to a google maps api.
I am using Twitter4J API on GAE/J. I want to use the request token
Is there a way to make HTML5's Geolocation only work, if it is using

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.