如果用户不允许使用该位置,则触发事件 [英] Event that fires if the user does not allow using the location

查看:67
本文介绍了如果用户不允许使用该位置,则触发事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能存在重复:
谷歌地图 - 用户选择不允许定位


如果用户不允许浏览器抓住他们的位置,并且使用默认的走廊集合来定位地图,我需要捕获它。



我会这样做吗?

谢谢

解决方案

gMap.setZoom(5);
gMap.setCenter(new google.maps.LatLng(44.44,-88.88));

gMap是您的地图。以上是你如何居中地图。我猜你有一个流程来决定他们是否允许浏览器抓住他们的位置。此时,您将设置中心的位置。无法掌握你现在正在做的事情。


Possible Duplicate:
google map - user choses not to allow location

I need to capture if the user does NOT allow the browser to grab thier location, and use a default set of corridinates to center the map.

How would I do this?

thank you

解决方案

gMap.setZoom(5); 
gMap.setCenter(new google.maps.LatLng(44.44, -88.88));

gMap being your map. Above is how you center the map. I am guessing you have a flow that determines if they allow the browser to grab their location. At that point is where you would set the center. Can't grasp much of what you are doing from what you currently have.

这篇关于如果用户不允许使用该位置,则触发事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆