Since January 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
* Some parts of this feature may have varying levels of support.
The popover property of the HTMLElement interface gets and sets an element's popover state via JavaScript ("auto", "hint", or "manual"), and can be used for feature detection.
It reflects the value of the popover global HTML attribute.
An enumerated value; possible values are:
"auto"auto popovers can be "light dismissed" — this means that you can hide the popover by clicking outside it or pressing the Esc key.
Usually, only one auto popover can be shown at a time — showing a second popover when one is already shown will hide the first one. The exception to this rule is when you have nested auto popovers. See Nested popovers for more details.
"hint" Experimental hint popovers do not close auto popovers when they are displayed, but will close other hint popovers. They can be light dismissed and will respond to close requests.
Usually they are shown and hidden in response to non-click JavaScript events such as mouseover/mouseout and focus/blur. Clicking a button to open a hint popover would cause an open auto popover to light-dismiss.
"manual"manual popovers cannot be "light dismissed" and are not automatically closed. Popovers must explicitly be displayed and closed using declarative show/hide/toggle buttons or JavaScript. Multiple independent manual popovers can be shown simultaneously.
You can use the popover attribute to feature detect the Popover API:
function supportsPopover() {
return Object.hasOwn(HTMLElement.prototype, "popover");
}
const popover = document.getElementById("mypopover");
const toggleBtn = document.getElementById("toggleBtn");
const popoverSupported = supportsPopover();
if (popoverSupported) {
popover.popover = "auto";
toggleBtn.popoverTargetElement = popover;
toggleBtn.popoverTargetAction = "toggle";
} else {
console.log("Popover API not supported.");
}
| Specification |
|---|
| HTML> # dom-popover> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
popover |
114 | 114 | 125 | 100 | 17 | 114 | 125 | 76 | 18.317–18.3On iOS and iPadOS, popovers are not dismissed when the user taps outside of the popover area, see bug 267688. |
23.0 | 114 | 18.317–18.3On iOS and iPadOS, popovers are not dismissed when the user taps outside of the popover area, see bug 267688. |
hint |
133 | 133 | No | 118 | No | 133 | No | 88 | No | No | 133 | No |
popover HTML global attribute
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/popover