-
1. Re: Google Maps issue with Chrome and Safari using XHTML
mgvarley Nov 26, 2008 6:43 PM (in response to mgvarley)I got this working thanks to some help on the Google Maps forum and more research on the Google Maps API. It appears that there are some known issues when using Google Maps with XHTML and since I guess that most Seam users are using Facelets like me then I thought I'd post the solution here. Firstly, replace your rich:gmap with a plain old div (not a big issue as the rich:gmap functionality is fairly limited anyway. Next, use the following javascript which uses the Google Maps AJAX Loader:
var GOOGLE_MAPS_API_KEY = "MYAPICODE";
var GOOGLE_MAPS_VERSION = "2";
function mapsLoaded() {
var map = new google.maps.Map2(document.getElementById
("map_canvas"));
map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);
}
function loadMaps() {
google.load("maps", GOOGLE_MAPS_VERSION, {"callback" : mapsLoaded});
}
function initLoader() {
var script = document.createElement("script");
script.src = "http://www.google.com/jsapi?key=" +
GOOGLE_MAPS_API_KEY + "&callback=loadMaps";
script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(script);
}That should get your maps working fine in IE, Firefox, Safari and Chrome.
mark
-
2. Re: Google Maps issue with Chrome and Safari using XHTML
zeppelinux.dmitry.diligesoft.com Nov 26, 2008 7:40 PM (in response to mgvarley)I had the same issue, fixed it by adding contentType to the template view (found it at some forum):
<f:view contentType="text/html">
IDEA complains about 'contentType' is not allowed, but it works.
-
3. Re: Google Maps issue with Chrome and Safari using XHTML
mgvarley Feb 19, 2009 12:29 PM (in response to mgvarley)Hi Dmitry - sorry for the slow reply (3 months!) but just had to re-visit this topic after complaints about my Google API key on my live server (caused by my postback solution I think as I definitely have the correct
live
API key on my server) and seen your response and it works a treat! Have reverted to using the much simpler gmap approach now.Thanks,
mark
-
4. Re: Google Maps issue with Chrome and Safari using XHTML
jbuechel Feb 19, 2009 3:55 PM (in response to mgvarley)Thanks guys!
This post saved me a lot of time!
Cheers
Jonas -
5. Re: Google Maps issue with Chrome and Safari using XHTML
raphaufrj Feb 27, 2010 6:34 PM (in response to mgvarley)Save my life too!!! ahuahau
Thanks a lot!!
-
6. Re: Google Maps issue with Chrome and Safari using XHTML
jojh Oct 29, 2010 3:37 AM (in response to mgvarley)Oh, Thank you very much!!
You saved me.