simpleweatherjs插件:Firefox要求我分享我的位置,但不会显示当前温度



嗨,我有一个来自simpleweatherjs的天气脚本,我觉得很奇怪,因为从我在那里找到的样本来看,所有东西都可以在diff浏览器上运行,但当我通过结合自动更新和地理定位来定制插件时,在堆栈中其他成员的帮助下,我设法使它运行,但只能在chrome上运行,因为当我在firefox上测试它时,它只问我是否我想分享位置后,我允许它没有发生

这是的全部代码

    <script type="text/javascript">
    $(document).ready(function() {
        getWeather();
        setInterval(getWeather, 6000);
    });
    function getWeather() {
        navigator.geolocation.getCurrentPosition(function(position) {
            var location = (position.coords.latitude + ',' + position.coords.longitude);
            var woeid = undefined;
            $.simpleWeather({
                location: location,
                woeid: woeid,
                unit: 'c',
                success: function(weather) {
                    html = '<h2><i class="icon-'+weather.code+'"></i>' + weather.temp + '&deg;' + weather.units.temp + '</h2>';
                    html += '<ul><li>' + weather.city + ', ' + weather.region + '</li>';
                    html += '<li class="currently">' + weather.currently + '</li></ul>';
                    $("#weather").html(html);
                },
                error: function(error) {
                    $("#weather").html('<p>' + error + '</p>');
                }
            });
        });
    }
</script>

有人能告诉我哪里出了问题吗?

simpleWeather的开发人员。我已经有一些人报告了这个问题,还有一些人没有任何问题。我做了一些挖掘,对于一些人来说,Firefox和地理位置似乎存在问题。我从Mozilla支持部门找到了这篇文章,并在stackoverflow上找到了关于这个问题的几个问题。不确定该解决方案是否能解决您的问题。

最新更新