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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:34:35+00:00 2026-05-26T10:34:35+00:00

I am not doing a large chunk of computation in JS. Everything works fine

  • 0
  1. I am not doing a large chunk of computation in JS.
  2. Everything works fine on iPad iOS 5 in Safari until I added this code:

    var watchID = navigator.geolocation.watchPosition(updatePos,locationError,{maximumAge: 10000, frequency: 60000, enableHighAccuracy: true, timeout: 1000});
    
    function updatePos(position) {       
        if (position.coords.accuracy < accuracyThreshold) {                 
            $.post(websiteRoot + '/ReportDeviceLocation?rand=' + (Math.random() * Math.random()) + '&longitude=' + position.coords.longitude + '&latitude=' +position.coords.latitude);
    
        } else {
            console.debug("Location data is not accurate enough. Location not updated.");
        }
    }
    
  3. Then the web page worked for about 4 minutes and I get this error:

    JavaScript execution exceeded timeout.

  4. Then no JavaScript would load. None of the debug messages I inserted into my.js file would print. Only the above error.

  5. The error persists even after I left the page that generated this error, and opened other web pages under the same domain.

  6. I used try and catch, I used setTimeout function, but neither gave me the source of the error nor solved the problem.

I don’t know what the problem is. It has been burning me for the entire day and will be burning me for the weekend.

  • 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-26T10:34:36+00:00Added an answer on May 26, 2026 at 10:34 am

    Surprisingly, when I used geolocation.getCurrentPosition, the error message stopped showing up.
    To replace watchPosition with getCurrentPosition, I use the function setInterval:

            function getLocation() {
                navigator.geolocation.getCurrentPosition(updatePos, locationError, { enableHighAccuracy: true, timeout: 10000 });
            }
    
            var intervalID = window.setInterval(getLocation, 10000);
    

    This has worked out better than watchPosition because watchPosition sometimes does not follow rules(update location 8 times in 3 minutes despite the frequency is set to 10 minutes).

    If the timeout still occurs, one would need to call clearInterval:

    var geolocationID;
    (function getLocation() {
         var count = 0;
         geolocationID = window.setInterval(
           function () {
                count++;
                if (count > 3) {  //when count reaches a number, reset interval
                    window.clearInterval(geolocationID);
                    getLocation();
                } else {
                    navigator.geolocation.getCurrentPosition(updatePos, locationError, { enableHighAccuracy: true, timeout: 10000 });
                }
            },
            600000); //end setInterval;
    })();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can you tell me how this line works.... my OperatorFactory.get(add) is not doing anything.
This is really confusing me as I'm not doing anything with Strings. This is
Not sure if I am doing this correctly or not. Here is my .js
I have the following code (sorry for the large code chunk, but I could
I'm not doing anything overly complex I believe. I'm presorting a large csv data
I'm not doing any fancy route patterns yet, just the basic controller, action, id
I don't know what I'm not doing but I simply cannot get my own
I'm writing a parallel Haskell program using Strategies. It's not doing what it's supposed
I'm trying to compare two different column types (not my doing, part of a
I want that the form will not close by doing Alt + F4 but

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.