我完全被这里吓到了。我使用 Google Places API 和 Google Maps Javascript API v3 来显示带有地址、电话号码等的商业地图……我在 Webkit 上开发了网站……然后我发现它在火狐...这是我的代码:
function initialize() {
var e = document.getElementById('place_reference')
if (e) {
var place_reference = document.getElementById('place_reference').innerText;
}
var request = {
reference: place_reference
};
service = new google.maps.places.PlacesService(document.getElementById('map_canvas'));
service.getDetails(request, callback);
function callback(place, status) {
console.log(status);
if (status == google.maps.places.PlacesServiceStatus.OK) {
document.getElementById('loading').style.display = 'none';
if (document.getElementById('place_address').innerText == '') {
document.getElementById('place_address').innerText = place.formatted_address;
}
if (document.getElementById('place_phone').innerText == '') {
document.getElementById('place_phone').innerText = place.international_phone_number;
}
if (document.getElementById('place_website').innerHTML == '') {
document.getElementById('place_website').innerHTML = '<a href="' + place.website + '"target="_blank">' + place.website + '</a>';
}
var place = place.geometry.location;
var marker;
var map;
var mapOptions = {
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true,
scrollwheel: false,
center: place
};
map = new google.maps.Map(document.getElementById('map_canvas'),
mapOptions);
marker = new google.maps.Marker({
map: map,
draggable: false,
animation: google.maps.Animation.DROP,
position: place
});
}
}
}
在 Firefox 上,状态返回 INVALID_REQUEST 而在其他浏览器上,它返回 OK
我真的需要帮助来解决这个问题。您可以通过以下地址查看网站: http: //social-e.laclinique.biz/en/blog/shops/noel-eternel