SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Addict
    Join Date
    Aug 2007
    Posts
    328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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:
    Code:
    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.

  2. #2
    SitePoint Zealot
    Join Date
    Apr 2010
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ive found out that chrome is not a good browser to test ur sites

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by GameInfiniti View Post
    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?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #4
    SitePoint Zealot
    Join Date
    Apr 2010
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yea lol, i also found that firefox and chrome are most similar

  5. #5
    SitePoint Member
    Join Date
    Apr 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are you sore that you have the correct code and the corect browser to test it?

  6. #6
    SitePoint Addict
    Join Date
    Aug 2007
    Posts
    328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  7. #7
    SitePoint Addict
    Join Date
    Aug 2007
    Posts
    328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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/experi...t/1-test/2.htm

    Please can someone tell me where the incompatibility is?

  8. #8
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by stevex33 View Post
    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/experi...t/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)
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  9. #9
    SitePoint Addict
    Join Date
    Aug 2007
    Posts
    328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

  10. #10
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by stevex33 View Post
    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"
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  11. #11
    SitePoint Addict
    Join Date
    Aug 2007
    Posts
    328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  12. #12
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    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
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  13. #13
    SitePoint Addict
    Join Date
    Aug 2007
    Posts
    328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •