Modernizr.geolocation 始终为真
我有一个 Modernizr 检查地理定位支持。我注意到它没有按预期工作,所以我输入了一些日志来查看发生了什么。看起来,无论浏览器中是否启用了地理定位,它都会发出警报。我知道我正确地在浏览器中禁用了地理定位,因为它按照我在网上找到的 Modernizr.geolocation 演示的预期工作。
//Check for geolocation support; hide "use my location" button if unsupported
if (Modernizr.geolocation) {
console.log('true');
//App.locateInit();
} else {
console.log('false');
//$('#geo-container').css('display','none');
}
我正在使用地理定位部分调用自定义 Modernizr 脚本。关于可能导致此问题的任何想法?请让我知道要寻找什么或您可能需要什么其他信息,我对 Modernizr 很陌生。
谢谢!
I have a Modernizr check for geolocation support. I noticed it wasn't working as expected so I put in some logs to see what was happening. It seems that it is alerting true whether geolocation is enabled in the browser or not. I know I'm disabling geolocation in my browser correctly because it works as expected for Modernizr.geolocation demos I've found online.
//Check for geolocation support; hide "use my location" button if unsupported
if (Modernizr.geolocation) {
console.log('true');
//App.locateInit();
} else {
console.log('false');
//$('#geo-container').css('display','none');
}
I'm calling the custom Modernizr script with the geolocation piece. Any ideas as to what could be causing this? Please let me know what to look for or what other info you may need, I'm very new to Modernizr.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
哪个浏览器?显然,您的浏览器在禁用 API 时不会删除该 API,这意味着无法检测到禁用情况。 :(
Which browser? Apparently your browser doesn't remove the API when its disabled, which means its impossible to detect the disabling. :(