+ Start a Discussion
the_wolfthe_wolf 

Google maps code (iframe) not show the map correctly in a visualforce page

Hi all

 

Is it easy to insert a google map in my visualforce page? I think that to insert a map is sufficient to make a copy and paste the code (which contains an iframe) generated by Google.

 

But in the IFRAME box there is the entire page of google instead of the mini-map!

 

Here's the code:

 

<iframe width="300" height="100" scrolling="no" src="http://maps.google.com/maps?q=ADDRESS...;">
<iframe><br /><small><a href="http://maps.google.com/maps?q=ADDRESS..." style="color:#0000FF;text-align:left">
Visualizzazione ingrandita della mappa</a></small>

 

I'm tried also to substitute the iframe tag with <apex:iframe> tag , but I obtain the same result.

 

So how can I insert the Google map throw the generated "iframe" code?

 

Thanks in advance

Best Answer chosen by Admin (Salesforce Developers) 
the_wolfthe_wolf

Hi all,

 

in this link there is an alternative solution to this problem.

 

This is most excellent and works well without the hassle of an API key.

Many thanks for the author, Alessandro

All Answers

TehNrdTehNrd

Yup, that's how iframes work, they simply embed the entire page you are referring to in the current page. To embed only google maps you will need to reference this site:

 

http://code.google.com/apis/maps/

Message Edited by TehNrd on 04-01-2010 02:51 PM
the_wolfthe_wolf

Hi TehNrd,

 

I didn't know if the problem was the iframe tag. I would understand why this same code works correctly on another site that is not on force.com, for example the following link:

 

http://agrisem.italiavetrina.it/contatti

 

So the Google Maps API is the only way to show the map in a Visualforce Page?

the_wolfthe_wolf

Hi all,

 

in this link there is an alternative solution to this problem.

 

This is most excellent and works well without the hassle of an API key.

Many thanks for the author, Alessandro

This was selected as the best answer