close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

More Google Maps on Multiple Domains

Thread began 5/23/2011 10:45 am by steve409203 | Last modified 8/17/2012 6:03 pm by sebastien441590 | 3534 views | 6 replies |

steve409203

More Google Maps on Multiple Domains

I have 2 pages on a web site using Google maps that are being accessed through 2 different domain names. I have read the other solutions to get this to work using PHP, but these sites are on a Windows-based file server.

The pages are:
contact-us.html
contact-us.html

specialized-programs.html
specialized-programs.html

Google suggests the following code as a solution:

document.write([
'<script src="http://maps.google.com/maps?file=api&v=2&key=', {
'domain1.com': 'apikey1',
'domain2.com': 'apikey2',
'domain3.com': 'apikey3',
'domainN.com': 'apikeyN'
}[window.location.host],
'" type="text/javascript"><\/script>'
].join(''));

but the question is, how do I implement this using the WebAssist generated Google maps code?

I have a test page at test.html but it does not work for either domain name

Thanks in advance for the help.

Sign in to reply to this post

Jason ByrnesWebAssist

on your page, find the following code:
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAk6WzVKHquYCaO_uEcPQb2xRMTIbAIa0I9oiudhyvwpjmrmhyKxSz1WO5cbboFSJvQ1Y345MsYA6njg">/*wagmp*/</script>



and replace with the code from google.

Sign in to reply to this post

steve409203

Re: More Google Maps on Multiple Domains

That's what I did. The code I'm using is:

<script type="text/javascript">
document.write([
'<script src="http://maps.google.com/maps?file=api&v=2&key=', {
'carringtonseniorservices.com': 'ABQIAAAAk6WzVKHquYCaO_uEcPQb2xRMTIbAIa0I9oiudhyvwpjmrmhyKxSz1WO5cbboFSJvQ1Y345MsYA6njg',
'carringtonseniorhealthservices.com': 'ABQIAAAAk6WzVKHquYCaO_uEcPQb2xR9ZuU-Q5Z2VfOwZ4Knk3bH4f3HHxRvlTCK4s7fX8PP57dmq2jGqKKxmQ'
}[window.location.host],
'" type="text/javascript"><\/script>'
].join(''));
</script>

...but it does not work on either domain name. The page is test.html

Sign in to reply to this post

Jason ByrnesWebAssist

you need to add the www. version of the domain names to the script as well, the script is working if you visit:
test.html

because you specified the api key to use for the
carringtonseniorhealthservices.com

domain. you need to specify the api key to use for the:
www.carringtonseniorhealthservices.com

domain as well.

Sign in to reply to this post

sebastien441590

@ Jason Byrne,

Hi,

You seem to really know your stuff so I thought I would ask this:


What I do is I SEO websites and then rent the traffic to customers. In order to do so, I "import" their whole page through an include so that visitors actually think they are visiting my client's site.

This new client of mine has Google Maps installed on her site, which causes an error when the page gets imported into mine.

What we did do:

- make sure each other's domains are approved under the key's access following this structure:

*.web-success-maketing.com/*
*.acces411.ca/*



I then put this code on my page:

document.write([
'<script src="http://maps.google.com/maps?file=api&v=2&key=', {
'web-success-marketing.com': 'AIzaSyBYRZu-ozTok0A2ktqihham77Ym2Yiu6Rk',
'www.web-success-marketing.com': 'AIzaSyBYRZu-ozTok0A2ktqihham77Ym2Yiu6Rk',
'acces411.ca': 'ABQIAAAAmfnmLtcTHrHhkpkNKRujrRRnRZM9i66V77rRaQmSxF8bpYq1RBQ2RLYMDfRCRcCPWBzO7serz8DfcA',
'www.acces411.ca': 'ABQIAAAAmfnmLtcTHrHhkpkNKRujrRRnRZM9i66V77rRaQmSxF8bpYq1RBQ2RLYMDfRCRcCPWBzO7serz8DfcA'
}[window.location.host],
'" type="text/javascript"><\/script>'
].join(''));



yet I still can't get this thing to work as I keep getting the error: This web site needs a different Google Maps API key. A new key can be generated at introduction.html#Obtaining_Key.


Now, I did ask my client to upgrade from v2 to v3, which she did so I'm a little perplexed about the v2 in the above error.

Also, on both our sites, both v2 and v3 are "on".


When I click ok, I get a message telling me Google deactivated the service because of an invalid key yet I did check both and they seem fine.


Here is a sample test page where you can see the whole code: test.php Please bear with the CSS error as it's nothing more than changing relative links to absolute ones which I'll do if I can get her page to load properly in my site...


thanks for your time!


Seb.

Sign in to reply to this post

Jason ByrnesWebAssist

to the best of my understanding, the google API console does not accept wild card characters in the domain registration. you have to enter the entire domain with out trying to use wild card characters when generating the api key.

also I believe the API key is now optional, both under the V2 and Newer V3 api.

instead of trying use javascript to fudge the api key, leave it out altogether.

Sign in to reply to this post

sebastien441590

Thanks Jason,

Have a nice weekend!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...