Skip to content
Related Articles

Related Articles

Improve Article

Google Maps Info Windows

  • Last Updated : 18 Aug, 2020
Geek Week

Google Maps Info Windows is used to add a window to display the information of the specific area. Usually, the info window is attached to a marker. You can attach an info window by instantiating the google.maps.InfoWindow class.


var infowindow = new google.maps.InfoWindow({content: "Content String"});
       , marker);

Property Values:

  • Content: Used to pass content in String format.
  • pixelOffset: It contains an offset from the tip of the info window to the location on which the info window is anchored, it is optional.
  • position: Used to choose the position of the info window.
  • maxWidth: To restrict the size of the info window horizontally. By default, the info window’s width will be stretched till the text is wrapped.



<!DOCTYPE html>
        <!-- Loading map API -->
        <script src=
            function GFG() {
                var CustomOp = {
                    center: new google.maps.LatLng(28.502212, 77.405603),
                    zoom: 17,
                // Map object
                var map = new google.maps
                .Map(document.getElementById("DivID"), CustomOp);
                var marker = new google.maps.Marker({
                    position: new google.maps.LatLng(28.502211, 77.405512),
                    map: map,
                    draggable: true,
                var infowindow = new google.maps.InfoWindow({
                    content: "5th Floor, A-118,Sector-136,"+
                             " Noida, Uttar Pradesh - 201305",
      , marker);
    <!-- load map -->
    <body onload="GFG()">
            <h1 style="color: green;">GeeksforGeeks</h1>
            <h3>Google Maps Info Windows</h3>
            <!-- Basic Container -->
            <div id="DivID" 
                 style="width: 400px; height: 300px;"></div>


Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it’s lowest price ever!

My Personal Notes arrow_drop_up
Recommended Articles
Page :