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

This method is not part of a specification.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

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

Document Tags and Contributors

 Contributors to this page: ranglaly, bunnybooboo, jpmedley
 Last updated by: ranglaly,