Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1130857 of Window.onappinstalled

  • Revision slug: Web/API/Window/oninstall
  • Revision title: Window.oninstall
  • Revision id: 1130857
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment bug 1280777

Revision Content

{{APIRef}}

The oninstall property of the {{domxref("Window")}} interface represent the event handler for the {{Event("install")}} event, which is thrown each time the page is successfully installed as a web app.

Syntax

window.oninstall = function(event) { ... };

Example

function handleInstall(ev) { 
  console.log('Thank you for installing our app!');
} 

window.oninstall = handleInstall;

Specifications

Specification Status Comment
{{SpecName('Manifest', '#oninstall-attribute', 'Window.oninstall')}} {{Spec2('Manifest')}} Initial specification.

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatUnknown}} {{CompatGeckoDesktop(49)}} [1] {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Android Webview Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support {{CompatUnknown}} {{CompatUnknown}} {{CompatGeckoMobile(49)}} [1] {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

[1] This feature is behind a feature preference setting. In about:config, set dom.manifest.oninstall to true.

See also

  • {{Event("install")}}

Revision Source

<div>{{APIRef}}</div>

<p>The <code><strong>oninstall</strong></code> property of the {{domxref("Window")}} interface represent the event handler for the {{Event("install")}} event, which is thrown each time the page is successfully installed as a web app.</p>

<h2 id="Syntax" name="Syntax">Syntax</h2>

<pre class="syntaxbox">
window.oninstall = function(event) { ... };
</pre>

<h2 id="Example">Example</h2>

<pre class="brush: js">
function handleInstall(ev) { 
  console.log('Thank you for installing our app!');
} 

window.oninstall = handleInstall;</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('Manifest', '#oninstall-attribute', 'Window.oninstall')}}</td>
   <td>{{Spec2('Manifest')}}</td>
   <td>Initial specification.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<div>{{CompatibilityTable}}</div>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoDesktop(49)}} [1]</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Android Webview</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
   <th>Chrome for Android</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoMobile(49)}} [1]</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] This feature is behind a feature preference setting. In about:config, set <code>dom.manifest.oninstall</code> to <code>true</code>.</p>

<h2 id="See_also">See also</h2>

<ul>
 <li>{{Event("install")}}</li>
</ul>
Revert to this revision