You need to sign in to do that
Don't have an account?
sandy_salesfdc1
Google map in visual-force component
The bellow component is giving returning blank(but its printing the value "Hellow all") when used in a visualforce page ..
but when used in a plain html in my local machine is returning the map.
Please advice
<apex:component > Hello all <style type="text/css"> html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #map-canvas { height: 100% } </style> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #map-canvas { height: 100% } </style> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=KeyXXXX&sensor=false"> </script> <script type="text/javascript"> function initialize() { var mapOptions = { center: new google.maps.LatLng(-34.397, 150.644), zoom: 8, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); } google.maps.event.addDomListener(window, 'load', initialize); </script> </head> <body> <div id="map-canvas"/> </body> </apex:component>
Hi,
Try this piece of code , It works correctly for me in my developer account.
Also , You need to add sidebar="false" showHeader="false" over the page in which you will use your Component as this removes the Standard Javascripts which were restricting the page to be displayed. Let me know if you face any issues.
Important :
Click on the Star Icon aside if this post provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Thank You