47

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.

user1978816
  • 812
  • 1
  • 8
  • 19
  • 1
    Looks like the SVN source browser is still available: https://code.google.com/p/google-maps-utility-library-v3/source/browse/trunk/infobox/src/infobox.js (just can't link to it on your page). – geocodezip May 11 '16 at 20:21
  • Thanks for asking, I haven't been able to find news about this elsewhere, but this question pointed me to the fact that it's a recent issue and helped calm down a (non-IT-trained) girlfriend who's somehow in charge of her company's WP website, and thought she'd broken something! – Michele C May 12 '16 at 15:47
  • Glad I could help, that is why i posed because I just didn't see anything online. – user1978816 May 12 '16 at 18:49
  • Anyone having the same problem and already knowing the file name. also noticed that it's not available. No extra information was provided. It is not a question for SO format. – Imre Pühvel May 14 '16 at 09:42

6 Answers6

27

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.

Matej P.
  • 5,303
  • 1
  • 28
  • 44
  • I know. I'm not a real web-develop and had based of examples I had seen online. The website was only supposed to be used internally by a few engineers but has migrated to a production environment without proper code review. My main point in posting this question was not so much to ask for help but to warn others and help out because I'm sure I'm not the only one to have linked against that code. – user1978816 May 12 '16 at 18:53
  • I understand. But it seems that there are a lot of developers who referenced it and might not be aware that it's a bad practise, hence the warning, before they apply a bad fix. – Matej P. May 12 '16 at 19:24
  • It works: url direct -> https://raw.githubusercontent.com/googlemaps/v3-utility-library/master/infobox/src/infobox.js – jruzafa Jun 22 '16 at 10:52
18

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.

Community
  • 1
  • 1
Chris Cook
  • 2,821
  • 1
  • 20
  • 32
  • 1
    This is not a good idea. What prevents the developers of the library to go and change the API of the library? They would issue an update, push it into master branch and everybody who has this link on production server would experience issues again. Also, nothing prevents developers from removing the library alltogether. You should provide link to stable version on stable hosting which won't change. If developers don't explicitly state otherwise, they don't guarantee such availability on github. – Matej P. May 14 '16 at 00:19
  • It would be ok if you had control over the repository to ensure that no change will happen to the files so you can safely link them, or owners of the repository would state so. But even then, you have to follow some rules, like not link files by branch but rather by commit to ensure they won't change and accept the fact that cdn.github doesn't guarantee availability. Check: https://github.com/rgrove/rawgit/wiki/Frequently-Asked-Questions#i-need-guaranteed-100-uptime-should-i-use-cdnrawgitcom and also the section 'How long does the CDN cache files? How can I make it refresh my file?' – Matej P. May 14 '16 at 04:17
8

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.

user1978816
  • 812
  • 1
  • 8
  • 19
0

Google code is apparently shut down per the announcement

Bidding farewell to Google Code

Thursday, March 12, 2015

  • January 25, 2016 - The project hosting service is closed. You will be able to download a tarball of project source, issues, and wikis. These tarballs will be available throughout the rest of 2016.

Certainly wasn't clear from the post that they were going to stop making the hosted code available for use externally.

Community
  • 1
  • 1
geocodezip
  • 158,664
  • 13
  • 220
  • 245
0

Managed to get back the Infobox (v.1.1.13) script from the browser cache. Can be downloaded from http://pastebin.com/PGciVVur, hope this helps someone

kirre20
  • 1
  • 1
0

I linked to this github repo that seems to be a similar one and my site works again:

https://raw.githubusercontent.com/oytunyuksel/Google-Maps-Infobox.js/master/src/infobox.js

  • 1
    Using code repository as a CDN is rarely a good idea, not only in terms of load, but also because it can suddenly change and render your site non-working or compromised – Vasfed May 12 '16 at 17:41