Info Window | Maps JavaScript API | Google for Developers (original) (raw)
API Reference v3.61 (weekly channel)
- Overview
- Maps
* Maps
* WebGL
* Coordinates
* Data-driven styling
* Controls
* Geometry Library - Places
* Places Widgets
* Place
* Autocomplete Data (new)
* Geocoder
* Places Service
* Places Autocomplete Service
* Address Validation (beta) - Journey Sharing
* Map View
* Authentication
* UI Customization
* Fleet Engine Entities
* Trip and Order Progress
* Fleet Tracking - Last Mile Fleet
* Fleet Tracking - On Demand Rides & Delivery
* Shipment Tracking
API Reference v3.60 (quarterly channel)
- Overview
- Maps
* Maps
* WebGL
* Coordinates
* Data-driven styling
* Controls
* Geometry Library - Places
* Places Widgets
* Place
* Autocomplete Data (new)
* Geocoder
* Places Service
* Places Autocomplete Service
* Address Validation (beta) - Journey Sharing
* Map View
* Authentication
* UI Customization
* Fleet Engine Entities
* Trip and Order Progress
* Fleet Tracking - Last Mile Fleet
* Fleet Tracking - On Demand Rides & Delivery
* Shipment Tracking
API Reference v3.59
- Overview
- Maps
* Maps
* WebGL
* Coordinates
* Data-driven styling
* Controls
* Geometry Library - Places
* Places Widgets
* Place
* Autocomplete Data (new)
* Geocoder
* Places Service
* Places Autocomplete Service - Journey Sharing
* Map View
* Authentication
* UI Customization
* Fleet Engine Entities
* Trip and Order Progress
* Fleet Tracking - Last Mile Fleet
* Fleet Tracking - On Demand Rides & Delivery
* Shipment Tracking
API Reference v3.58
- Overview
- Maps
* Maps
* WebGL
* Coordinates
* Data-driven styling
* Controls
* Geometry Library - Places
* Places Widgets
* Place
* Autocomplete Data (new)
* Geocoder
* Places Service
* Places Autocomplete Service - Journey Sharing
* Map View
* Authentication
* UI Customization
* Fleet Engine Entities
* Trip and Order Progress
* Fleet Tracking - Last Mile Fleet
* Fleet Tracking - On Demand Rides & Delivery
* Shipment Tracking
Info Window
Stay organized with collections Save and categorize content based on your preferences.
InfoWindowclass
google.maps.InfoWindow
class
An overlay that looks like a bubble and is often connected to a marker.
This class extends[MVCObject](/maps/documentation/javascript/reference/event#MVCObject)
.
Access by calling const {InfoWindow} = await google.maps.importLibrary("maps")
or const {InfoWindow} = await google.maps.importLibrary("streetView")
.
See Libraries in the Maps JavaScript API.
Constructor | |
---|---|
InfoWindow | InfoWindow([opts]) Parameters: opts: InfoWindowOptions optional Creates an info window with the given options. An InfoWindow can be placed on a map at a particular position or above a marker, depending on what is specified in the options. Unless auto-pan is disabled, an InfoWindow will pan the map to make itself visible when it is opened. After constructing an InfoWindow, you must call open to display it on the map. The user can click the close button on the InfoWindow to remove it from the map, or the developer can call close() for the same effect. |
Properties | |
---|---|
isOpen | Type: boolean Checks if the InfoWindow is open. |
Methods | |
---|---|
close | close() Parameters: None Return Value: None Closes this InfoWindow by removing it from the DOM structure. |
focus | focus() Parameters: None Return Value: None Sets focus on this InfoWindow. You may wish to consider using this method along with a visible event to make sure that InfoWindow is visible before setting focus on it. An InfoWindow that is not visible cannot be focused. |
getContent | getContent() Parameters: None Return Value: string|Element |
getHeaderContent | getHeaderContent() Parameters: None Return Value: string|Element |
getHeaderDisabled | getHeaderDisabled() Parameters: None Return Value: boolean|undefined Whether the whole header row is disabled or not. See InfoWindowOptions.headerDisabled. |
getPosition | getPosition() Parameters: None Return Value: LatLng|null |
getZIndex | getZIndex() Parameters: None Return Value: number The zIndex of this InfoWindow. |
open | open([options, anchor]) Parameters: options: InfoWindowOpenOptions|Map |
setContent | setContent([content]) Parameters: content: string|Element |
setHeaderContent | setHeaderContent([headerContent]) Parameters: headerContent: string|Element |
setHeaderDisabled | setHeaderDisabled([headerDisabled]) Parameters: headerDisabled: boolean optional Specifies whether to disable the whole header row. See InfoWindowOptions.headerDisabled. Return Value: None |
setOptions | setOptions([options]) Parameters: options: InfoWindowOptions optional Return Value: None |
setPosition | setPosition([position]) Parameters: position: LatLng|LatLngLiteral optional The LatLng position at which to display this InfoWindow. Return Value: None |
setZIndex | setZIndex(zIndex) Parameters: zIndex: number The z-index for this InfoWindow. An InfoWindow with a greater z-index will be displayed in front of all other InfoWindows with a lower z-index. Return Value: None |
Inherited: addListener,bindTo,get,notify,set,setValues,unbind,unbindAll |
Events | |
---|---|
close | function() Arguments: None This event is fired whenever the InfoWindow closes. For example, this could be from calling the InfoWindow.close method, pressing the escape key to close the InfoWindow, or clicking the close button or moving the InfoWindow to another map. |
closeclick | function() Arguments: None This event is fired when the close button was clicked. |
content_changed | function() Arguments: None This event is fired when the content property changes. |
domready | function() Arguments: None This event is fired when the containing the InfoWindow's content is attached to the DOM. You may wish to monitor this event if you are building out your info window content dynamically. |
headercontent_changed | function() Arguments: None This event is fired when the headerContent property changes. |
headerdisabled_changed | function() Arguments: None This event is fired when the headerDisabled property changes. |
position_changed | function() Arguments: None This event is fired when the position property changes. |
visible | function() Arguments: None This event is fired when the InfoWindow is fully visible. This event is not fired when InfoWindow is panned off and then back on screen. |
zindex_changed | function() Arguments: None This event is fired when the InfoWindow's zIndex changes. |
InfoWindowOptionsinterface
google.maps.InfoWindowOptions
interface
InfoWindowOptions object used to define the properties that can be set on a InfoWindow.
Properties | |
---|---|
ariaLabel optional | Type: string optional AriaLabel to assign to the InfoWindow. |
content optional | Type: string|Element |
disableAutoPan optional | Type: boolean optional Default: false Disable panning the map to make the InfoWindow fully visible when it opens. |
headerContent optional | Type: string|Element |
headerDisabled optional | Type: boolean optional Disables the whole header row in the InfoWindow. When set to true, the header will be removed so that the header content and the close button will be hidden. |
maxWidth optional | Type: number optional Maximum width of the InfoWindow, regardless of content's width. This value is only considered if it is set before a call to open(). To change the maximum width when changing content, call close(), setOptions(), and then open(). |
minWidth optional | Type: number optional Minimum width of the InfoWindow, regardless of the content's width. When using this property, it is strongly recommended to set the minWidth to a value less than the width of the map (in pixels). This value is only considered if it is set before a call to open(). To change the minimum width when changing content, call close(), setOptions(), and then open(). |
pixelOffset optional | Type: Size optional The offset, in pixels, of the tip of the info window from the point on the map at whose geographical coordinates the info window is anchored. If an InfoWindow is opened with an anchor, the pixelOffset will be calculated from the anchor's anchorPoint property. |
position optional | Type: LatLng|LatLngLiteral optional The LatLng at which to display this InfoWindow. If the InfoWindow is opened with an anchor, the anchor's position will be used instead. |
zIndex optional | Type: number optional All InfoWindows are displayed on the map in order of their zIndex, with higher values displaying in front of InfoWindows with lower values. By default, InfoWindows are displayed according to their latitude, with InfoWindows of lower latitudes appearing in front of InfoWindows at higher latitudes. InfoWindows are always displayed in front of markers. |
InfoWindowOpenOptionsinterface
google.maps.InfoWindowOpenOptions
interface
Options for opening an InfoWindow
Properties | |
---|---|
anchor optional | Type: MVCObject|AdvancedMarkerElement optional The anchor to which this InfoWindow will be positioned. If the anchor is non-null, the InfoWindow will be positioned at the top-center of the anchor. The InfoWindow will be rendered on the same map or panorama as the anchor (when available). |
map optional | Type: Map|StreetViewPanorama optional The map or panorama on which to render this InfoWindow. |
shouldFocus optional | Type: boolean optional Whether or not focus should be moved inside the InfoWindow when it is opened. When this property is unset or when it is set to null or undefined, a heuristic is used to decide whether or not focus should be moved. It is recommended to explicitly set this property to fit your needs as the heuristic is subject to change and may not work well for all use cases. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-23 UTC.