Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion Dynamic API key assignment (was Re: Using the Maps API with the Common AJAX Loader (Dynamic loading!))
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Joe  
View profile  
 More options Aug 28 2007, 6:12 pm
From: Joe <jsixp...@gmail.com>
Date: Tue, 28 Aug 2007 15:12:39 -0700
Local: Tues, Aug 28 2007 6:12 pm
Subject: Dynamic API key assignment (was Re: Using the Maps API with the Common AJAX Loader (Dynamic loading!))
Hi there,

The loader seems to have an undocumented feature, in that the API key
can be set after including the JS source.
This works for me:

<-- load the Ajax loader w/o API key -->
<script type="text/javascript" src="http://www.google.com/jsapi"></
script>

<script type="text/javascript">
        var gKey = '';
        switch (window.location.hostname) {
                        case 'localhost':
                                gKey = 'ABQIAAAA0cEo...';
                                break;
                        case 'www.example.com':
                                gKey = 'YBeYhAA0cEoDf...';
                                break;
        }
        google.loader.ApiKey = gKey;       // UNDOCUMENTED feature
        google.loader.KeyVerified = true;   // not necessary, but defaults to
false otherwise(!?)
        google.loader.LoadFailure = false;  // not necessary, but defaults to
true otherwise(!?)
        google.load("maps", "2");
</script>

Setting the KeyVerified and LoadFailure values does not have any
effect in my tests (these seem not to be evaluated when loading the
map api).

Is this supposed to work the way it does and can we rely on this
behavior for production scripts?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.