The newest release version of the Google Maps JavaScript (3.32.13) is conflicting with Prototype.js version 1.7.3.
When I have Prototype included on the page, the Street View of Google Maps will not handle mouse drags to "look around"
Is this a known issue? Any workarounds?
The Maps JavaScript API provides a Street View service for obtaining and manipulating the imagery used in Google Maps Street View. This Street View service is supported natively within the browser. Although Street View can be used within a standalone DOM element, it is most useful when indicating a location on a map.
This Street View service is supported natively within the browser. Although Street View can be used within a standalone DOM element, it is most useful when indicating a location on a map. By default, Street View is enabled on a map, and a Street View Pegman control appears integrated within the navigation (zoom and pan) controls.
Before you begin: Before you start using the Maps JavaScript API, you need a project with a billing account and the Maps JavaScript API enabled. To learn more, see Get Started with Google Maps Platform . The Maps JavaScript API lets you customize maps with your own content and imagery for display on web pages and mobile devices.
Street View images are supported through use of the StreetViewPanorama object, which provides an API interface to a Street View "viewer.". Each map contains a default Street View panorama, which you can retrieve by calling the map's getStreetView() method.
I also struggled with the conflict between Prototype.js and Google API. Removing Prototype.js was not an option as it is deeply engrained in the project. I decided to replace
Array.from = $A;
by
Array.from = Array.from || $A;
in the prototype.js file. It keeps the support for older browsers which do not have Array.from implemented natively. This does not solve the conflict between Prototype.js and Google API on older browsers though!
This site overrides Array.from() with an implementation that doesn't support iterables, which could cause Google Maps JavaScript API v3 to not work correctly.
I also have the same issue. So, I reopened a relevant GM API tkt: https://issuetracker.google.com/issues/72690631
I tried to rename the function collect into prototype.js but it didn't work.
So the problem is that PrototypeJS is overwriting Array.from
as an alias to $A()
which creates an extended Array object.
IF (big IF) you are not using Array.from
to create a shallow copy of an array and expecting the Prototype extended methods, you can remove/comment out the line in prototype.js that is only
Array.from = $A;
In my copy of 1.7.3 it is line 1114
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With