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 6337959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:21:03+00:00 2026-05-24T19:21:03+00:00

simple question.. how do I set a redirect if the user selects not allow

  • 0

simple question.. how do I set a redirect if the user selects not allow for the geolocator pop up? If allow and error I have covered. works fine. But I’ not sure how to set the not allow selection.

function showLocation(position) {
      var latitude = position.coords.latitude;
      var longitude = position.coords.longitude;
      //window.location = "/restaurant/latitude/40.714269/longitude/-74.005972/";
      window.location = "/restaurant/";
    }

    function errorHandler(err) {
      if(err.code == 1) {
            alert("Error: Can not access!");
      }else if( err.code == 2) {
            alert("Error: Position is unavailable!");
      }
    }
    function getLocation(){

       if(navigator.geolocation){
          // timeout at 60000 milliseconds (60 seconds)
          var options = {timeout:60000};
          navigator.geolocation.getCurrentPosition(showLocation, errorHandler, options);
       }else{
          alert("Sorry, browser does not support geolocation!");
       }
    }
  • 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-24T19:21:04+00:00Added an answer on May 24, 2026 at 7:21 pm

    According to the W3C Geolocation API spec, the error handler should be invoked with the appropriate reason for the failure. This includes permission denied by the user.

    Unfortunately, it seems like there is a bug/feature in Firefox where if you select Not Now from the popup, nothing happens – the error handler is not called. However, if you select Never Share, your error handler does get called and with the code you posted, you’ll see the alert saying Error: Can not access!.

    There is no third option in Chrome (only Allow and Deny) and things seem to work just fine there.

    Also see How to detect negative user response for geolocation where a solution is proposed (it involves using a timeout to detect that nothing has happened and treating it the same as permission denied)

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

Sidebar

Related Questions

i have a simple question.. in registration script.. how can i set the limit
Simple question. After a little bit of 'chmod' shenanigans, I have set the permissions
I have a simple question about Backbone.js' get and set functions. 1) With the
Simple question, but I haven't found a good explanation on google. When using Set
Simple question that keeps bugging me. Should I HTML encode user input right away
This is actually a two-part question. My server is set up to redirect all
Simple question: does it matter which side of a bidirectional many-to-many relationship you set
Hopefully simple question: I'm trying to set the alternatingItemColors on a datagrid via some
Here's a simple question I've been stuck on for a while. When I set
Simple question this time, is there a way in ASP.NET to set a decimal

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.