【问题标题】:Show spinner on HTML5 Geolocation request在 HTML5 地理位置请求上显示微调器
【发布时间】:2016-07-12 06:41:19
【问题描述】:

我在 html 网页中有一个按钮,单击该按钮后它将获得 Geolocation 详细信息,可能是请求将处理大约 5 seconds,因此最好显示微调器或加载消息用户表明他们的请求正在处理中。

这是我尝试过的。

if (navigator.geolocation) {
    //request starts Showing the spinner at this point.

    navigator.geolocation.getCurrentPosition(function(position) {

        //get coordinates

    }, function (error) {
        // Handle errors !!This callback isn't execute if a user close the 
        // geolocation prompt or click on `Not Now` option in the prompt

        // So its not always correct to hide the spinner in here.

    }, {enableHighAccuracy: true, timeout: 8000});
}

errorCallback 中隐藏微调器并不总是正确的,因为如果用户close Geolocation prompt 或单击提示中的Not Now 选项,则不会执行此回调,如下图所示。

最好的方法是什么?

【问题讨论】:

    标签: javascript jquery html geolocation


    【解决方案1】:

    【讨论】:

    • 对不起,这个问题与微调器无关
    猜你喜欢
    • 1970-01-01
    • 2023-04-02
    • 1970-01-01
    • 2011-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多