相关疑难解决方法(0)

JavaScript执行超过了超时

  1. 我在JS中没有做大量的计算.
  2. 在我添加此代码之前,Safari iOS iOS 5上的一切正常工作:

    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.");
        }
    }
    
    Run Code Online (Sandbox Code Playgroud)
  3. 然后网页工作了大约4分钟,我得到这个错误:

    JavaScript执行超过了超时.

  4. 然后没有JavaScript会加载.我插入到my.js文件中的调试消息都不会打印出来.只有上面的错误.

  5. 即使在我离开生成此错误的页面并在同一域下打开其他网页后,错误仍然存​​在.

  6. 我用过try和catch,我使用了setTimeout函数,但是既没有给我错误的来源也没有解决问题.

我不知道问题是什么.它一整天都在燃烧我,并会在周末燃烧我.

javascript safari geolocation ipad

6
推荐指数
1
解决办法
5941
查看次数

标签 统计

geolocation ×1

ipad ×1

javascript ×1

safari ×1