2016-04-25 111 views
0

我有一個自定義的Google地圖,其中標記是動態填充的,我嘗試將標記鏈接重定向到Google地圖上相應的地點詳細信息頁面。例如,在標記點擊上,我想爲此鏈接打開一個新窗口:https://www.google.com/maps/place/PMBCOM/@46.381949,6.236581,17z/data=!3m1!4b1!4m2!3m1!1s0x478c372f7df47135:0xff206d31a973ededGoogle Maps API - 鏈接到地點詳細信息頁面

現在,我可以重定向到該地址,但它不顯示完整的「Google我的商家」面板,例如我的上一個鏈接。有任何想法嗎 ?

這裏是我的代碼:

function initMap() { 
    var myLatlng = new google.maps.LatLng(agence[0], agence[1]); 
    var map = new google.maps.Map(document.getElementById('maps'), { 
    center: myLatlng, 
    zoom:17 
}); 

var infowindow = new google.maps.InfoWindow(); 
var service = new google.maps.places.PlacesService(map); 

service.getDetails({ 
    placeId: 'ChIJ71BChS4ujEcRclm9twk3Y04' 
}, function(place, status) { 
    if (status === google.maps.places.PlacesServiceStatus.OK) { 
     var marker = new google.maps.Marker({ 
     map: map, 
     position: place.geometry.location, 
     title: place.name, 
     url: 'https://www.google.com/maps/place/'+place.formatted_address 
}); 
google.maps.event.addListener(marker, 'click', function() { 
    infowindow.setContent(place.name); 
    infowindow.open(map, this); 
    window.open(marker.url); 
    }); 
} 
}); 
} 
google.maps.event.addDomListener(window, 'load', initMap); 

感謝您的幫助

回答

1

看看這部分

url: 'https://www.google.com/maps/place/'+place.formatted_address 

谷歌無法找到該公司以這種方式

變化

url: place.url 

我覺得這是你想要的

相關問題