Search code examples
javascriptuiwebviewwkwebviewios11

IOS11 WebView for "Add to home screen" button


After iOS11 upgrade, what WebView (WebKit) is used for "Add to home screen" button from Safari (used to see apps in fullscreen)?
I know that in iOS 10, it was using UIWebView.

Is it an upgrade for UIWebView or is it replaced with WKWebView?

I saw that in iOS 11, I don't have the problem with the 300 ms delay, but I have some problems with the orientation change.

Thank you


Solution

  • Based on the JavaScript test of this answer, Web Apps are getting displayed in a WKWebView in iOS 11.

    You can also validate this with the following code snippet:

    function browserTest() {
      var whatBrowser = document.getElementById("whatBrowser");
      var lte9 = /Constructor/i.test(window.HTMLElement);
      var nav = window.navigator, ua = nav.userAgent, idb = !!window.indexedDB;
      var browserText = "Other Browser"; 
    
      if (ua.indexOf('Safari') !== -1 && ua.indexOf('Version') !== -1 && !nav.standalone) { 
        browserText = "Safari";
      } else if ((!idb && lte9) || !window.statusbar.visible) {
        browserText = "UIWebView";
      } else if ((window.webkit && window.webkit.messageHandlers) || !lte9 || idb) {
        browserText = "WKWebView";
      }
      
      whatBrowser.innerHTML = browserText;
    }
    <html>
      <head>
        <meta name="apple-mobile-web-app-capable" content="yes">
      </head>
      <body onload="browserTest();">
        <p id="whatBrowser"></p>
      </body>
    </html>