fonkap
fonkap

Reputation: 2509

Google Maps and Richfaces 3.3.3 (prototype.js 1.6.0.3) possible incompatibility

I have a web application based on RichFaces 3.3.3 that uses Google Maps (maps-api v3), that was working fine until recently.

Lately is failing to draw the map's user controls. Map is drawn fine but the controls don't appear, map type or zoom control, for example.

Investigating a little, it seems a compatibility problem with prototype.js.

If you simply add this line to the example in developers.google.com:

<script src="http://prototypejs.org/assets/2008/9/29/prototype-1.6.0.3.js"></script>

js console in chrome browser logs this:

Uncaught TypeError: undefined is not a function       prototype-1.6.0.3.js:641

And the user controls dissapear...

Somebody knows how to solve this problem??

Now I'm going to try to change prototype.js in richfaces for a more modern version... I'll update when I know more.

Thanks in advance!

--- UPDATE ---

--- UPDATE 2 ---

In other words, use this in your page for backguards compatibility with prototype-1.6.0.3.js:

<script src="https://maps.googleapis.com/maps/api/js?v=3.17"></script>

Upvotes: 4

Views: 2483

Answers (5)

user1883467
user1883467

Reputation: 61

Adding parameter v=3.xx is obsolete coming 2024 april

Upvotes: 0

AbidCharlotte49er
AbidCharlotte49er

Reputation: 964

This function at line number 629ish in prototype.js is causing the exception. Simply add try catch blocks as shown below. It works with any Google Maps API.

collect: function(iterator, context) {
  iterator = iterator ? iterator.bind(context) : Prototype.K;
  var results = [];
  try {
    this.each(function(value, index) {
      results.push(iterator(value, index));
    });
  } catch (err) {}
  return results;
}

Upvotes: 0

yiwei
yiwei

Reputation: 1

Change to version v3, the conflict with prototype will disappear, I have tried in my site, it works fine.

Upvotes: 0

giscommander1985
giscommander1985

Reputation: 31

Yes!! the solution for me was change the line from:

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false" />

to

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&v=3" />

Thanks!!

Upvotes: 3

eepete
eepete

Reputation: 156

I had the same problem this morning. Got the same error, controls like the zoom control would not render. I upgraded my prototype.js to the latest version (1.7.2) from version (1.7) and things worked again. Am using google maps api V3, the production version. Don't know if it was the newer version prototype.js or if Google changed something and then fixed something, but it's happy now.

Upvotes: 8

Related Questions