ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Problem Running Google Maps in popup
Title:
B
I
{code}
?
hi Why Doesn't Google Maps Work within popup?? I used this code in popup: <div id="googleMap" style="width:100%;height:400px;"></div> <script> function myMap() { var mapProp= { center:new google.maps.LatLng(51.508742,-0.120850), zoom:5, }; var map=new google.maps.Map(document.getElementById("googleMap"),mapProp); } </script> <script src="https://maps.googleapis.com/maps/api/js?key= **your-key-Api** &callback=myMap"></script> But it worked in view properly. best wishes
Save Changes
Cancel
dear
asked at 13 Feb 2017
Answers
B
I
{code}
?
even though you shouldn't load your script inside the popup (because it will reload every time you open the popup) your code should still work you can see it working by opening the latest demo, in `PopupDemo/Index.cshtml` add <script src="https://maps.googleapis.com/maps/api/js?key=*youAPIkey*" async defer></script> and in `PopupWithParameters.cshtml` add <div id="map" style="height: 200px;"></div> <script> var map; function initMap() { map = new google.maps.Map(document.getElementById('map'), { center: {lat: -34.397, lng: 150.644}, zoom: 8 }); } initMap(); </script> after you can see it running; as for your specific case, as always check the console for errors, google the errors messages etc.
Save Changes
Cancel
Omu
answered at 13 Feb 2017
worked,thanks a lot
at 14 Feb 2017
dear
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK