title: PWA in iOS 12 no longer re-executing Javascript when re-opening app
body: <p>I have a PWA which essentially re-directs the user to the messages app on open using Javascript. With the roll-out of iOS 12 and changes to PWAs, the webpage no longer re-initializes and executes the Javascript when it is re-opened or when it re-gains focus. Instead, it now loads the previously saved state and won't re-execute the Javascript.</p>
  
  <p>Does anyone have any ideas around this? Can I force Javascript execution every time the PWA has focus? Can I force the page to re-initialize on load? </p>
  
  <p>Sample code below:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;html manifest="ios/scripts/offline.manifest"&gt;
  
  &lt;head&gt;
  &lt;meta content="en-us" http-equiv="Content-Language" /&gt;
  &lt;meta content="text/html; charset=utf-8" http-equiv="Content-Type" /&gt;
  &lt;title&gt;SMS&lt;/title&gt;
  
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;meta name="apple-mobile-web-app-title" content="SMS"&gt;
  &lt;meta name="apple-mobile-web-app-capable" content="yes" /&gt;
  &lt;meta name="apple-mobile-web-app-status-bar-style" content="black" /&gt;
  
  
  &lt;link rel="apple-touch-icon" sizes="180x180" href="ios/img/Icon-60x60@3x.png"&gt;
  &lt;link rel="apple-touch-startup-image" href="ios/img/LaunchImage-1125@3x~iphoneX-portrait_1125x2436.png" media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;script&gt;
          if (window.navigator.standalone) {
              document.write('&lt;a id="url" href="sms:1111111111" name="url"&gt;&lt;/a&gt;');
              var e = document.getElementById('url');
              var ev = document.createEvent('MouseEvents');
              ev.initEvent('click', true, true);
              e.dispatchEvent(ev);
          }
  &lt;/script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  
  
  </code></pre>