Google Maps App working Only In Chrome?

Hi Guys,
I’ve written a google maps app for work and have got it all running nicely…in chrome.

I’ve only just noticed that for some reason it’s not working in firefox or internet explorer.

I was wondering if someone could take a look at the simple extract that I’ve made and show me where I’m going wrong (If I am):

Javascript:


function initialize() {
	if (GBrowserIsCompatible()) {
		//Create a div called map_canvas in the html where the map will be displayed
		var map = new GMap2(document.getElementById("map_canvas"));
		//Set the map to center on these coordinates
		map.setCenter(new GLatLng(55.872759,-4.297972), 15);
		
		//Add controls to the map, such as zoom types and map display types
		map.addControl(new GMapTypeControl());
		map.addControl(new GLargeMapControl());
		
	}
}

Then in the body tag I’ve got:
<body onload=“initialize()”>

When I say “doesn’t work” I mean that I’ve tried putting in alerts throughout the code to see where it’s stopping.
In firefox, all the alerts come out fine, but still no map display.
In internet explorer, no alerts and no map.

Any assistance would be greatly appreciated.

ive found out that chrome is not a good browser to test ur sites

Is that because Chrome behaves more correctly so you don’t need to put in work-arounds for other browsers until to experience them in those other browsers?

yea lol, i also found that firefox and chrome are most similar

are you sore that you have the correct code and the corect browser to test it?

The code works in chrome, and it should work in firefox and internet explorer as well.
The only thing I can think of is that I’m using onload for the page.
I’ll use some jquery instead and see if it makes a difference.
In the mean time, if anyone else has any ideas, I’d really appreciate the feedback.

I’ve just tried jquery and still no luck.
Seems to work fine in chrome,safari and opera but not at all in firefox or internet explorer.

Here’s a url where you can find the map:
http://www.makeagreatsite.com/experiments/javascript/1-test/2.htm

Please can someone tell me where the incompatibility is?

Those browsers fail to understand “application/javascript” as a type of script.

Use “text/javascript” instead, or no script type at all (as it defaults to javascript)

excellent, thanks for the advice.
I made the change and it now appears to work fine in internet explorer, however it’s still not displaying in firefox.

Is there anything else that could be amiss?

There are still scripts on the page using “application/javascript”
Those will not work. Replace them with “text/javascript”

Sorry I wasn’t very clear.
I updated the pages locally on my computer and was still experiencing the issue.
I’ve updated the page on my website for you to see now.
Still the issue with firefox only.

I was puzzled about why the update wasn’t working for me on Firefox, until I realised that I had disabled javascript in Firefox. After enabling scripting it works fine for me.

You may have a similar issue, or may just need to force a refresh with ctrl+F5

thanks for your advice.
I noticed after you said that, that I couldn’t even see the google maps on google, confirming that it’s definitely a browser issue rather than a coding issue.
I’ve disabled all addons but no luck, so I just uninstalled, reinstalled and all is well.

Thanks again.