How do you keep an iPhone/iPad web app in full screen mode?

后端 未结 6 2083
别那么骄傲
别那么骄傲 2020-12-07 15:47

I have an HTML5 iPad app that works offline. The app essentially consists of 4 html files and 3 aspx files. My cache manifest is setup so that only the html files are avai

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-07 16:19

    The solution I've settled with is Waypoints for handling internal links. It has an open() method for external links which works up until iOS 6. After which you need this other fix for iOS 7.

    // Internal link handling
    Waypoints
      .intercept('a')
      .ignore('a[rel=external], a[rel=blank], a[target=_blank], a[href$=".pdf"]');
      // .resume();
    
    // External link handling...
    $('a').on('click', function(e) {
      var href = $(this).attr('href');
    
      if ($(this).is('a[rel=external], a[rel=blank], a[target=_blank], a[href$=".pdf"]') || (href.indexOf('http') >= 0 && href.indexOf(document.location.host) === -1)) {
        e.preventDefault();
        var link = this;
    
        if (navigator.standalone) {
          if (/iP(hone|od|ad) OS 7/.test(navigator.userAgent)) {
            // iOS 7 external link polyfill
            e.stopPropagation();
    
            // Your custom dialog code for iOS 7 and external links
          }
          else {
            Waypoints.open(href);
          }
        }
        else {
          window.open(href);
        }
      }
    });
    

    There's also Swipy.js you should check out, it includes Waypoints as a library and I might include all this link handling and the iOS 7 fix if it's worth it.

提交回复
热议问题