title: Does iOS support the "beforeinstallpromp" event?
body: <p>Chrome in Android and Desktop supports "beforeinstallpromp" event which is can show up add to homescreen banner. I'm try to use the same javascript code for my PWA in iOS but it is doesn't work. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>/**
   * Clear caches
   */
  function pwaClearCaches()
  {
      //Clear caches
      caches.keys().then(function(names) {
          for (let name of names) {
              caches.delete(name);
          }
      });
  }
  
  var pwa_app_installed = false; //PWA is already installed
  var deferredPrompt; //Link to show dialog event
  $(document).ready(function(){
      if (window.location.protocol === 'http:') { //Если это HTTP протокол, а не HTTPS
          console.log(lang.t('You need HTTPS for work'));
      }
  
      if ('serviceWorker' in navigator) {
          /**
           * Подвешиваемся на переключение режима правки, чтобы сразу очистить кэш
           */
          $('.debug-mode-switcher').on('click', function () {
              if (!$('.debug-mode-switcher .toggle-switch').hasClass('on')) {
                  //Delete service worker
                  navigator.serviceWorker.getRegistrations().then(function (registrations) {
                      for (let registration of registrations) {
                          registration.unregister();
                      }
                  });
  
                  //Clear caches
                  pwaClearCaches();
              }
          });
      }
  
      if ($.cookie('update_pwa_cache')){ //Update cache if we have cookie на обновление
          pwaClearCaches();
          $.cookie('update_pwa_cache', '', {expires: -1});
      }
  
      /**
       * Close window with prompt
       */
      function closePWAInstallWindow()
      {
          $("#pwaInstall").hide();
          $.cookie('not_show_pwa', '1');
      }
  
      let body = $('body');
      /**
       * Add to homescreen event 
       */
      body.on('click', '#pwaAddToHomeScreen', function(){
          deferredPrompt.prompt(); // Show alert to install
          deferredPrompt.userChoice.then((choiceResult) =&gt; {//Wait for user choose
              if (choiceResult.outcome === 'accepted') { //Accept install
                  closePWAInstallWindow();
              } else { //Cansel install
                  closePWAInstallWindow();
              }
              deferredPrompt = null;
          });
          return false;
      });
      /**
       * Close intalll window
       */
      body.on('click', '#pwaCloseInstall', function(){
          closePWAInstallWindow();
          return false;
      });
  });
  
  
  console.log('out');
  
  //If we not in webapp and no session that we need to install
  if (!(window.matchMedia('(display-mode: standalone)').matches) &amp;&amp; !$.cookie('not_show_pwa')) {
      /**
       * Event that app is installed
       */
      $(window).on('appinstalled', (evt) =&gt; {
          pwa_app_installed = true;
      });
  
      console.log('not fired');
  
      /**
       * Event beforeinstallprompt from browser
       */
      $(window).on('beforeinstallprompt', (e) =&gt; {
          // Prevent Chrome 67 and earlier from automatically showing the prompt
          e.preventDefault();
          // Stash the event so it can be triggered later.
          deferredPrompt = e.originalEvent;
          console.log('fired');
  
          var is_mobile_android = false;
          var ua = navigator.userAgent;
  
          if (/Android/i.test(ua) &amp;&amp; /Chrome/i.test(ua)){ //If we in Android and it is Chrome prevent native window
              is_mobile_android = true;
          }
  
          if (!pwa_app_installed &amp;&amp; !is_mobile_android){
              let body = $('body');
              body.append('&lt;div id="pwaInstall" class="pwaInstall" style="background-color: #fff"&gt;' +
                  '&lt;div class="content"&gt;Please install our app&lt;/div&gt;&lt;div class="links"&gt;' +
                      '&lt;a href="#" id="pwaAddToHomeScreen" style="background-color: #fff; color: #000;"&gt;Add to homescreen&lt;/a&gt;' +
                      '&lt;a href="#" id="pwaCloseInstall" style="background-color: yellow; color: black;"&gt;No Thanks&lt;/a&gt;' +
                  '&lt;/div&gt;' +
              '&lt;/div&gt;');
  
              setTimeout(function () { //Show our banner
                  $("#pwaInstall").addClass('show');
              }, 100);
          }
      });
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>And I have manifest.json</p>
  
  <pre><code>{
      "short_name": "VaporStore",
      "name": "VaporStore &amp; FreeVape",
      "description": "Магазин свободного пара",
      "icons": [
          {
              "src": "/storage/system/resized/xy_64x64/0f08cd435767735a778ea63fea5b5efd_e2f1b76.png",
              "type": "image/png",
              "sizes": "64x64"
          },
          {
              "src": "/storage/system/resized/xy_128x128/0f08cd435767735a778ea63fea5b5efd_b510eb77.png",
              "type": "image/png",
              "sizes": "128x128"
          },
          {
              "src": "/storage/system/original/0f08cd435767735a778ea63fea5b5efd.png",
              "type": "image/png",
              "sizes": "192x192"
          },
          {
              "src": "/storage/system/original/272d68dfbb5e80ef67f6c7abcb2391cb.png",
              "type": "image/png",
              "sizes": "512x512"
          }
      ],
      "background_color": "#ffffff",
      "theme_color": "#ff9800",
      "display": "standalone",
      "orientation": "portrait",
      "start_url": "/",
      "scope": "/"
  }
  </code></pre>
  
  <p>And I have service worker based on workbox from Google.</p>
  
  <p>Does iOS support the "beforeinstallpromp" event or not? On Android and Desktop chrome works fine. </p>
  
  <p><strong>Update 04.04.2019</strong>
  The most full answer is given here:
  <a href="https://www.youtube.com/watch?v=s5ASNwnBttQ" rel="noreferrer">https://www.youtube.com/watch?v=s5ASNwnBttQ</a> </p>
  
  <p>from the clip: "iOS 12.2 does not support beforeinstallprompt" (mention is made of add to home screen behavior via 'Share Screen')</p>