- Home
- Technical Library
- Boards
- Cookbook
- Code Share
- Blogs
- Partners
-
More
-
Services
- Training & Certification
- Support
-
Galleries
- Force.com Sites Gallery
- Chatter Challenge Entries
-
Other Web Sites
- Salesforce.com
- Database.com
- AppExchange
- CRM Community
-
Discussions
- Announcements
- General Development
- Schema Development
- New to Cloud Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules Discussion
- Security
- Mobile
- Force.com Sites
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby Development
- Adobe Flash Builder for Force.com
- Desktop Integration
- REST API Integration
- Streaming API
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- Excel Connector
- AJAX Toolkit & S-controls
- Force.com Builder & Native Apps
- AppExchange Directory & Packaging
- Force.com Labs Projects
- Open Source
- Site.com
- Jobs Board - Administrators
- Jobs Board - Developers
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Visualforce Development
- :
- Google map driving directions in Visualforce
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Google map driving directions in Visualforc e
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-02-2010 03:12 AM
I created a component which contains the gmap API for driving directions.
<apex:component >
<apex:attribute name="LocationA" description="Location A" type="String" required="true" />
<apex:attribute name="LocationB" description="Location B" type="String" required="true" />
<div id="map_canvas" style="width: 100%; height: 375px; background-color: #ffffff;">
<script src=" http://maps.google.com/—file=api&v=2.x&
key=ABQIAAAATLMNChkxHLNMBMyJTWj6NBRI1GHY-WN6xuGUGn sHkEIkRmE15BQKtJjUz7L1VCIpVF7qmtbghbpPAA"
type="text/javascript"></script>
<script type="text/javascript">
var dirFrom = '{!LocationA}';
var dirTo = '{!LocationB}';
function initialize() {
if (GBrowserIsCompatible()){
map = new GMap2(document.getElementById("map_canvas"));
directionsPanel = document.getElementById("my_textual_div");
map.setCenter(new GLatLng(49.496675,-102.65625), 3);
directions = new GDirections(map, directionsPanel);
directions.load("from: dirFrom to:dirTo");
}
}
var previousOnload = window.onload;
window.onload = function() {
if (previousOnload) {
previousOnload(); }
initialize(); }
</script>
</div>
</apex:component>
The page which references the controller:
<apex:page standardController="Account" showheader="false">
<c:DrivingDirection
LocationA="{!Account.BillingPostalCode}+{!Account. BillingState}+{!Account.BillingCountry}"
LocationB="{!$User.PostalCode}+ {!$User.State}+ {!$User.Street}">
</c:DrivingDirection>
</apex:page>
I am calling this VF page from a custom button.The content source for the button is URL.
But the page is showing blank with a warning that "the page contains non-secure items".
Appreciate any help on the issue.
Thanks & Regards,
Norman
Re: Google map driving directions in Visualforc e
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-02-2010 08:57 AM
Are you using IE? What happens in firefox?
Re: Google map driving directions in Visualforc e
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-02-2010 11:08 AM
I used IE, Firefox as well as chrome.
It's not showing up in any one of them.
Thanks for replying back.
Regards,
Norman
Re: Google map driving directions in Visualforc e
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-02-2010 01:13 PM
LocationA="{!Account.BillingPostalCode}+{!Account.BillingState}+{!Account.BillingCountry}"
LocationB="{!$User.PostalCode}+ {!$User.State}+ {!$User.Street}">
In above comments remove + with space and try, make sure it pass expected parameter details to gmap. first try by sending hardcoded address. let see
Re: Google map driving directions in Visualforc e
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-02-2010 01:43 PM
Hi,
I tried removing spaces but the result was same.
The blank page is showing that the security certificate is issued to *.na5.force.com
Is it an issue of the gmap api key?
I tried generating the key for all instances but the result was same.
I wonder if I can pass in values to direction.load() for the API.
Thanks for replying.
Cheers,
Norman
Re: Google map driving directions in Visualforc e
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-12-2011 11:08 PM
I have tried above code. I have added the above component and saved it and futher i am added the VF code but it's unable to save. It is giving error "Syntax Error". Plz suggest me a solution for this.

