Google’s JavaScript API – Can we have SWFAddress as well?
I have recently become a fan of Google’s very simple JavaScript API. The sole purpose of this project is to avoid all of us including common libraries like SWFObject or jQuery in every project we create and instead load it from a central (updated) repository. I have since used this in many projects.
However, who decides which libraries to include and how common should a library be, before Google will include it? Personally I believe they should add SWFAddress to the list of supported libraries as well.
You can however still load SWFObject from the Google JavaScript API and SWFAddress from a local file without any problems. It is quite straightforward:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"> </script> <script type="text/javascript" src="js/swfaddress.js"></script> <script type="text/javascript"> swfobject.embedSWF("file.swf", "target", "100%", "100%", "9.0.0"); </script>
Simply including the SWFAddress library after the Google JS API script works like expected.
But what is the potential consequences or drawbacks from doing this – depending on Google for serving site-breaking libraries? Some note, that this will increase load time, as the user’s browser now has to create a new connection to a new domain, do DNS lookup and the whole thing. I believe, that when enough sites use the libraries this way, every user will soon have the libraries cached, and when they visit your site for the first time, they will already have all the libraries needed and can thus use the page several seconds faster than if they had to download yet another copy of jQuery to their local cache.
And of course, I have to mention the possibility, that if Google goes out of business, your sites will break. But, it is way more likely that all your libraries will go defunct before Google kicks the bucket, so I believe that to be the least or your worries.
Please share your thoughts on whether it is at all meaningful to use Google JavaScript API and if so, how to determine or influence which libraries they should support.
Related posts:
Category: API, Flash Platform, JavaScript Comment »
