RenatoSousa89 / google-ajax-apis

Automatically exported from code.google.com/p/google-ajax-apis
0 stars 0 forks source link

google.load with calback property set makes Opera throw an Error #203

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi! I'm trying to get google.load(); load Google Map for me and do a
callback when it's done. My script is all working good in Firefox 2 and 3,
Safari, IE 7/8, but I have had no luck with it in Opera 9.x (currently
using 9.63).

So, today I wrote a small HTML file which looked like this:
<html>
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
    <title>Gmap test</title>

    <script type="text/javascript"
src="http://www.google.com/jsapi?key=xxx"></script>
    <script type="text/javascript">
      google.load("maps", "2.x");

      // Call this function when the page has been loaded
      function initialize() {
        var map = new google.maps.Map2(document.getElementById("map"));
        map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);
      }
      google.setOnLoadCallback(initialize);
    </script>

  </head>
  <body>
    <div id="map" style="width: 400px; height: 400px; border: 1px solid
gray;"></div>
  </body>
</html>

As you can see, it's just a test-page where I have copied your example from
http://code.google.com/apis/maps/documentation/#AJAX_Loader and this
example works in Opera. 

Now, if I try to run this:
<html>
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
    <title>Gmap test</title>

    <script type="text/javascript"
src="http://www.google.com/jsapi?key=xxx"></script>
    <script type="text/javascript">
      google.load("maps", "2.x", {callback: initialize});

      // Call this function when the page has been loaded
      function initialize() {
        var map = new google.maps.Map2(document.getElementById("map"));
        map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);
      }
    </script>

  </head>
  <body>
    <div id="map" style="width: 400px; height: 400px; border: 1px solid
gray;"></div>
  </body>
</html>

It will not work in Opera, but it works in the other browsers. I get a nice
little error which goes as follows:
Error:
name: TypeError
message: Statement on line 1: Cannot convert undefined or null to Object
Backtrace:  [Comment was too long - deleted the rest].

Original issue reported on code.google.com by thherman...@gmail.com on 23 Feb 2009 at 9:24

GoogleCodeExporter commented 8 years ago
No one is reading here? :-p

Original comment by thherman...@gmail.com on 27 Feb 2009 at 6:01

GoogleCodeExporter commented 8 years ago
What if you put the google.load call below where you define function initialize?

Original comment by jrgeer...@gmail.com on 27 Feb 2009 at 10:51

GoogleCodeExporter commented 8 years ago
Thanks for your reply!
Nope, just tested it now - same error in Opera. 

Original comment by thherman...@gmail.com on 28 Feb 2009 at 8:15

GoogleCodeExporter commented 8 years ago
I'm running into the same issue, have you had any luck resolving this?

Original comment by paul.b.g...@gmail.com on 10 Dec 2009 at 6:52