Could it be that simple? Yes, I believe it is. However, I did it differently by adding two more options to the code so that it now checks to see if it is with or without the www, and if it is org or com. The reason I did it this way is that I remember reading somewhere that using the negative number on the substring length did not work on IE. Maybe it does on the latest version, not sure. Anyway, it seems to work now. Thanks Andrew!
On Dec 14, 6:43 pm, Andrew Leach <[email protected]> wrote: > On Dec 14, 11:02 pm, Charlie <[email protected]> wrote: > What about www? A location.host for "www.bullitcountyhistory.org" is > not the same as location.host for "bullitcountyhistory.org", and that > will mess up your key-switching. > > What you might try is first defining a string > var tld = location.host.toLowerCase(); > tld = tld.substring(tld.length-3); > and then just using the TLD portion of the hostname: > { > 'org': 'ABQIAAAA1h...', > 'com': 'ABQIAAAA1h...' > }[tld] + > > What that does is convert your hostname to lowercase and then take > just the last three characters. That way it doesn't matter if the URL > is camel-case, or uses "www" or not. Since a key for > bullitcountyhistory.com will also work forwww.bullitcountyhistory.com, > if you get a key for the first one you only need to check that your > URL has "com" at the end. > > Andrew -- You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
