Has anybody been able to implement Google Maps v3 on a Web Part page (SharePoint 2010)?
The maps render fine if I display them in a separate .aspx page, but as soon as I try to embed the code in a Content Editor Web Part or a Form Web Part, I get a blank page. I did the test in both Internet Explorer and Firefox.
I'd be really interested to see a working example. Again, I have two constraints:
- Google Maps v3 API (not v2): http://code.google.com/apis/maps/documentation/javascript/
- within a SP 2010 Web Part page (no Page Viewer Web Part of course...)
Update: I got this to work, below an example. Google sample: http://code.google.com/apis/maps/documentation/javascript/examples/map-simple.html
My test (note the explicit width and height on the div):
<div id="map_canvas" style="width:300px;height:300px;">placeholder</div>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var myLatlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
</script>