title: pwa - prompt add to home screen dosen't show
body: <p>I develop a web application with symfony 4.3, then I add pwa features to it. I test with lighthouse extension in chrome and this is result:</p>
  
  <p><a href="https://i.stack.imgur.com/54d27.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/54d27.png" alt="enter image description here"></a></p>
  
  <p>Now problem is prompt for add icon to home screen dosen't show and I have this error :</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'prompt' of undefined</p>
  </blockquote>
  
  <p>code js:</p>
  
  <pre><code>var deferredPrompt ;
  var btnAdd = document.getElementById('butInstall') ;
  
  function launchPromptPwa(){
      var deferredPrompt;
  
      btnAdd = document.getElementById('butInstall') ;
  
      window.addEventListener('beforeinstallprompt',  (e) =&gt; {
          console.log('0');
  
          // Prevent Chrome 67 and earlier from automatically showing the prompt
          e.preventDefault();
          // Stash the event so it can be triggered later.
          deferredPrompt = e;
          btnAdd.style.display = block;
          showAddToHomeScreen();
      });
  
      btnAdd.addEventListener('click', (e) =&gt; {
          console.log('1');
          //btnAdd.style.display = 'none';
          //Show the prompt
          deferredPrompt.prompt();
          // Wait for the user to respond to the prompt
          deferredPrompt.userChoice
              .then((choiceResult) =&gt; {
                  if (choiceResult.outcome === 'accepted') {
                      console.log('User accepted the A2HS prompt');
                  } else {
                      console.log('User dismissed the A2HS prompt');
                  }
                  deferredPrompt = null;
              });
      });
  
  
      window.addEventListener('appinstalled', (evt) =&gt; {
          console.log('a2hs installed');
      });
  
      if (window.matchMedia('(display-mode: standalone)').matches) {
          console.log('display-mode is standalone');
      }
  
  }
  </code></pre>
  
  <p>I test for the display prompt in chrome.</p>