Sha256: 5fa5fc7a410bbb9454218b08b6cc3060c739ad7dc69df5b1c096b062de6f70a3

Contents?: true

Size: 822 Bytes

Versions: 23

Compression:

Stored size: 822 Bytes

Contents

// from https://gist.github.com/1042026
// Mobile Safari in standalone mode
if(("standalone" in window.navigator) && window.navigator.standalone){

  // If you want to prevent remote links in standalone web apps opening Mobile Safari, change 'remotes' to true
  var noddy, remotes = true;

  document.addEventListener('click', function(event) {

    noddy = event.target;

    // Bubble up until we hit link or top HTML element. Warning: BODY element is not compulsory so better to stop on HTML
    while(noddy.nodeName !== "A" && noddy.nodeName !== "HTML") {
      noddy = noddy.parentNode;
    }

    if('href' in noddy && noddy.href.indexOf('http') !== -1 && (noddy.href.indexOf(document.location.host) !== -1 || remotes)) {
      event.preventDefault();
      document.location.href = noddy.href;
    }

  },false);
}

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
woople-theme-0.8.1 spec/dummy/app/assets/javascripts/stay-standalone.js
woople-theme-0.8.0 spec/dummy/app/assets/javascripts/stay-standalone.js
woople-theme-0.6.27 spec/dummy/app/assets/javascripts/stay-standalone.js