Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps API V3 Infobox.js removed

One of our production pages stopped working properly. Tracked it down to the fact that one of the dependencies does not exist anymore:

http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/src/infobox.js

This URL is used in most of the example codes that were the basis of the webpage.

This is probably easily solved but a quick google showed no one has noticed this, I think it has happened in the last hour and just wanted to put the information out there in case people are panicking.

like image 287
user1978816 Avatar asked May 11 '16 19:05

user1978816


3 Answers

It seems that the library is being moved to Github (it seems the infobox.js wasn't moved yet), see the announcement on main page: https://code.google.com/p/google-maps-utility-library-v3/ But still, the problem with your code is that it's not a good practise to reference code from code.google.com svn repository. It's like referencing a code from Github, it can be changed/moved/removed any time. You should either download the code and include it in your project as .js file or host it yourself on some CDN server.

UPDATE

The google utility library (including infobox) is hosted here on github now. As said before, it's not mean to be referenced from there in projects.

like image 142
Matej P. Avatar answered Nov 10 '22 07:11

Matej P.


As Google moved the source over to GitHub a while back, the new GitHub version can be accessed from RawGit by using the following script urls (standard and packed versions):

https://cdn.rawgit.com/googlemaps/v3-utility-library/master/infobox/src/infobox.js
https://cdn.rawgit.com/googlemaps/v3-utility-library/master/infobox/src/infobox_packed.js

Whilst the above urls (with the cdn prefixes) have no traffic limits or throttling and the files are served via a super fast global CDN, please bear in mind that RawGit is a free hosting service and offers no uptime or support guarantees.

Accessing files maintained via GitHub is covered in more detail in the following SO answer:

Link and execute external JavaScript file hosted on GitHub

This post also covers that, if you're linking to files on GitHub, in production you should consider targeting a specific release tag to ensure you're getting a specific release version of the script.

For example, you could target the 1.1.13 release of the InfoBox library with the following script urls (standard and packed versions):

https://cdn.rawgit.com/googlemaps/v3-utility-library/infobox/1.1.13/src/infobox.js
https://cdn.rawgit.com/googlemaps/v3-utility-library/infobox/1.1.13/src/infobox_packed.js

Alternatively, you could download and include the library directly in your project for production purposes.

like image 21
Chris Cook Avatar answered Nov 10 '22 07:11

Chris Cook


As an emergency fix I copied the code from here: https://code.google.com/p/google-maps-utility-library-v3/source/browse/trunk/infobox/src/infobox.js?r=466

and linked locally. This appears to work fine for a quick fix but I will need to look for an alternative that see active updates.

like image 8
user1978816 Avatar answered Nov 10 '22 07:11

user1978816