Tutorial :Using google maps API with varied domains



Question:

Ok, so I have a site that uses the google maps API, and I want to serve it from more domains. The fact that the API key is tied to a domain greatly hinders my efforts on this front.

Is there any solution more elegant than getting a key for every domain?


Solution:1

There is one way you can avoid using the API key completely - use the version 3 API.

The v3 API is still in 'beta' but it has the key (no pun intended) functionality that most people use for their maps and there are no keys required. Nor will there be in the future according to Google. If you can get by without features like draggable markers, then v3 will work well. I use it for my primary map page and have no problems with it.


Solution:2

You can set up a proxy. But obviously that will complicate your code, and it's your responsibility to make sure only your domains can access the proxy.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »