Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google maps not showing up

I have a written a simple code which would display the location on the google map. But for some reasons its not showing up. Any idea whats happening?

<html>
<head>
<title>Google Maps </title>
<script type="text/javascript" 
src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
(function() {
   window.onload = function(){
   var latlng = new google.maps.LatLng(57.8, 14.0);
   var options = {
      zoom: 6,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
        }; 
  var map = new google.maps.Map(document.getElementById('map'), options);
        }
    })();
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
like image 618
dazzle Avatar asked Sep 14 '11 15:09

dazzle


People also ask

Why is Google Maps not displaying?

There are various reasons why this happens. It's possible the location accuracy option is disabled, you're using an older version of the app, or you don't have proper access to the internet. The Google Maps app itself may have issues, too. Cache files and other app data can sometimes cause various issues with the app.

Is there a problem with Google Maps right now?

Maps.google.com is UP and reachable by us.

How do I get Google Maps back on my home screen?

Add a shortcut to get directions On your Android phone or tablet, go to the widget section. Touch and hold the widget and drop it on your Home screen.

What happened to my Google Maps app?

On October 15, 2021, the My Maps app for Android devices will be shut down and removed from the Play Store. To continue to use My Maps on your mobile device, open your web browser and go to mymaps.google.com.


1 Answers

You need to set dimensions for your map container, try this:

<style type="text/css">
     #map {
        width: 500px;
        height: 500px;
      }
    </style>
like image 59
Jorge Zapata Avatar answered Oct 12 '22 21:10

Jorge Zapata