2016-04-25 23 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 

Googleは、このように

変更をこの会社を見つけることができません

url: place.url 

私はこれがあなたが望むものだと思います