The
prompt()
method of the BeforeInstallPromptEvent
interface allows a developer to show the install prompt at a time of their own choosing. Syntax
BeforeInstallPromptEvent.prompt()
Parameters
None.
Returns
An empty Promise
.
Example
var isTooSoon = true; window.addEventListener("beforeinstallprompt", function(e) { if (isTooSoon) { e.preventDefault(); // Prevents prompt display // Prompt later instead: setTimeout(function() { isTooSoon = false; e.prompt(); // Throws if called more than once or default not prevented }, 10000); } // The event was re-dispatched in response to our request // ... });
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
prompt | Chrome Full support 45 | Edge Full support ≤79 | Firefox No support No | IE No support No | Opera No support No | Safari No support No | WebView Android Full support 45 | Chrome Android Full support 45 | Firefox Android No support No | Opera Android No support No | Safari iOS No support No | Samsung Internet Android Full support 5.0 |
Legend
- Full support
- Full support
- No support
- No support
- Experimental. Expect behavior to change in the future.
- Experimental. Expect behavior to change in the future.
- Non-standard. Expect poor cross-browser support.
- Non-standard. Expect poor cross-browser support.