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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:42:45+00:00 2026-05-28T00:42:45+00:00

I’m attempting to get the users location for a mobile web app, if their

  • 0

I’m attempting to get the users location for a mobile web app, if their browser doesn’t support geolocation then send them to a default map center location. This works fine on Firefox, but when I test it on an iPhone it prompts for location usage then the map does not render. I noticed though once I close safari and reopen it the map then begins to render with the geolocation. Is this a bug in safari or something wrong in the way i am initializing my map?

function init() {
    var center = new google.maps.LatLng(42.283151,-87.955098);  
    if (navigator.geolocation) { 
        navigator.geolocation.getCurrentPosition(function(position) {  

        var loc = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);


        map = new google.maps.Map(document.getElementById('map_canvas'), {
        zoom: 11,
        center: loc,
        mapTypeId: google.maps.MapTypeId.ROADMAP
        });

        new google.maps.Marker({
          position: point,
          map: map
        });
      }); 
  } 
  else {
            map = new google.maps.Map(document.getElementById('map_canvas'), {
        zoom: 15,
        center: center,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    });  

  }  
}
  • 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-28T00:42:45+00:00Added an answer on May 28, 2026 at 12:42 am

    Are you waiting long enough for the iPhone’s GPS to get a fix on your location? This initial activation of location services can take a while to get an accurate location to return to the API, which explains why the subsequent load works as intended.

    It might be worth your while to add some code to indicate that the HTML5 geolocation function is running (perhaps displaying a “Loading…” message after you call getCurrentPosition).

    An error callback would be worthwhile as well to catch and gracefully handle and errors that occur during getCurrentPosition. You can definitely run into cases where navigator.geolocation is true but it won’t trigger the success function you’ve defined.

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

Sidebar

Related Questions

I have been attempting to get log4net logging in my asp.net web application with
I am attempting to get the X Window at a certain location on screen.
I'm building a Facebook app and I have noticed that when attempting to get
I'm attempting to add a function to my site where users can set their
I'm attempting to connect to an api and get a user from a donation
I am attempting to get Memory leak detection working with the help of these
I am attempting to get full path of a selected node in the package
I am attempting to get some information from a website, the info that I
I am attempting to get the current weather given a zip code or a
I am attempting to get a thread running which will be responsible for detecting

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.