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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:53:53+00:00 2026-06-11T10:53:53+00:00

I want to display information on a page if the user’s browser is requesting

  • 0

I want to display information on a page if the user’s browser is requesting permission to allow us to determine the user’s position, however I don’t want to attempt to display this information if the browser has already been authenticated to give us their location.

Is there a good way of doing this?

In detail. I want to display a message saying “Please click the box saying ‘Allow these guys to get your location’ ” because in user testing we’re finding that users don’t see the dialogue and become confused.

However, that results in us flashing up the help message even if we have their permission as they pass through the location lookup page. Storing the fact that they gave us their permission doesn’t help, because they may revoke that permission and we won’t know.

Any ideas?

Cheers
Mark.

  • 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-11T10:53:54+00:00Added an answer on June 11, 2026 at 10:53 am

    You can hand over an Error Callback to getCurrentPosition() to determine, whether the user has denied the tracking / Position could not be determined (spec).

    Additionally I would set a TimeOut which prompts your message after a certain amount of time because in this case the user most likely might have overlooked the browser dialog.

    sample code:

    function getLocation(){
      if (navigator.geolocation) {
         navigator.geolocation.getCurrentPosition(showPosition,showError);
         // set a Timeout, after which the user gets prompted
         // ugly global var but you could prevent this e.g. with a closure
         t = window.setTimeout(
                  function(){alert("Please allow us to locate you;) !")},3000
             );
      } else {
         alert("Geolocation is not supported by this browser.");
      }
    }
    function showPosition(position){
          alert("Latitude: " + position.coords.latitude + " - Longitude: " + position.coords.longitude);
          // position could be determined, clear the timeout
          window.clearTimeout(t);   
    }
    function showError(error){
      // an error occured, clear the timeout as well
      window.clearTimeout(t);
      switch(error.code) {
        case error.PERMISSION_DENIED:
          alert("User denied the request.");
          // Do stuff here, etc. ask the user to please allow the request
          break;
        case error.POSITION_UNAVAILABLE:
          alert("No Location information available.");
          break;
        case error.TIMEOUT:
          // user probably didn't recognize the browser dialog
          alert("The request timed out.");
          break;
        case error.UNKNOWN_ERROR:
          alert("An unknown error occurred.");
          break;
        }
    }
    

    However, you can still store the permission and check it. In case they revoke their permission you will run into the error-callback where you can take actions accordingly.

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

Sidebar

Related Questions

i want my jsp page to display the operating system information to the user.
I want to display information about the logged in user (username, company name, number
I want to store user information after logging in and to display my login
In my app,I want to display some information in the middle of the screen
I want to parse the tabular information from a .pdf file,and want to display
I have a vector of beans that holds information I want to display in
When users edit their account, I want to display a confirmation page that shows
Basically, I want to display local events to people on a page. So if
OK, I am using jqgrid to only display a subset of information. I want
I want to display the windows user that the application is running as on

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.