views:

24

answers:

2

I've been using Google Jsapi like so:

<script type="text/javascript" src="http://www.google.com/jsapi"&gt;&lt;/script&gt;
<script type="text/javascript">
    google.load("jquery", "1.3");
</script>

But the Google docs recommend doing this:

<script type="text/javascript" src="http://www.google.com/jsapi?key=YOUR_KEY_HERE"&gt;&lt;/script&gt;
    <script type="text/javascript">
        google.load("jquery", "1.3");
    </script>

In my experience, it seems to work whether you include the key or not.

Will I encounter any problems if I don't use a key?

+1  A: 

I would say that if the documentation says you need to include it, then you should include it. They may start enforcing that rule with no further notice, and your application may stop working.

If you restrict yourself to following the public API, you should be safe from Google changing their service, and your application breaking.

That advice holds for any other non-public APIs as well.

pkaeding
+1  A: 

I don't think you need it for loading libraries such as jQuery, but the same loader is used for several other APIs such as Google Maps, which may require a valid API key.

Also, this is what Google has to say about using a key:

The API key costs nothing, and allows us to contact you directly if we detect an issue with your site.

casablanca