我注意到在 FF4 中我可以使用地理定位对象 position.address.postalCode 查找邮政编码。
在 FF10 上进行测试时,我注意到 position.address 始终为 null,而我仍然可以毫无问题地使用position.coords 来查找经度或纬度。
有人可以告诉我是否有简单的方法可以通过位置对象查找 FF10 中的邮政编码?
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(findClosestAgencies);
}
function findClosestAgencies(position) {
alert("postalCode:" + position.address.postalCode);
alert("latitude:" + position.coords.latitude);
}
我的代码:
谢谢
最佳答案
根据规范:
http://dev.w3.org/geo/api/spec-source.html#position_interface
位置只需要坐标和时间戳。 FF4 可能有一些额外的数据,但不能保证它存在,因为它不是规范的一部分。尝试通过地址查找服务使用坐标。
关于google-maps-api-3 - 浏览器位置.地址.邮政编码始终为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9486423/