Our volunteers haven't translated this article into Bahasa Indonesia yet. Join us and help get the job done!
You can also read the article in English (US).

The Window.onbeforeinstallprompt property is an event handler for processing a beforeinstallprompt, which is dispatched on mobile devices when a web manifest exists, but before a user is prompted to save a web site to a home screen.


window.addEventListener("beforeinstallprompt", function(event) { ... });
window.onbeforeinstallprompt = function(event) { ...};


The following example uses the beforeinstallprompt function to verify that it is an appropriate time to display an installation prompt to the user. If it is not, the event is redispatched.

var isTooSoon = true;
window.addEventListener("beforeinstallprompt", function(e) { 
  if (isTooSoon) {
    e.preventDefault(); // Prevents prompt display 
    // Prompt later instead: 
    setTimeout(function() { 
      isTooSoon = false; 
      e.prompt(); // Shows prompt 
    }, 10000); 

  // The event was re-dispatched in response to our request 
  // ... 

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
Basic support 45 No support No support 32 No support
Feature Android Webview Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support 45 45 No support No support 32 No support 45.0 [1]


Specification Status Comment
Web App Manifest
The definition of 'Window.onbeforeinstallprompt' in that specification.
Working Draft Initial specification.

See Also

Tag Dokumen dan Kontributor

 Kontributor untuk laman ini: jpmedley, chrisdavidmills, teoli
 Terakhir diperbarui oleh: jpmedley,