BeforeInstallPromptEvent.prompt()

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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
  // ...
});

Specifications

Specification Status Comment
Web App Manifest
The definition of 'BeforeInstallPromptEvent.prompt()' in that specification.
Working Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
prompt
Experimental
Chrome Full support 45Edge ? Firefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android Full support 45Chrome Android Full support 45Firefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android Full support Yes

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.