This method is not part of a specification.
This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The prompt()
method of the BeforeInstallPromptEvent
interface allows a developer to show the install prompt at a time of their own choosing.
BeforeInstallPromptEvent.prompt()
None.
An empty Promise
.
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 // ... });
This method is not part of a specification.
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 45.0 [1] |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | No support | 45.0 [1] | 45.0 [1] |
[1] Behind the flag: chrome://flags/#bypass-app-banner-engagement-checks
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/BeforeInstallPromptEvent/prompt