Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jumplee/078658c19d78b3b52030 to your computer and use it in GitHub Desktop.
Save jumplee/078658c19d78b3b52030 to your computer and use it in GitHub Desktop.
//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 = false;
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);
alert('请安装新版本!');
location.href='../../dist/index.html';
}
//ios8 兼容
if( navigator.appVersion.match(/(iPad|iPhone|iPod)/g) && navigator.appVersion.match(/OS 8/g)){
$(document).ready(function(){
// $('#ios8_statusbar').show();
// $('body').css('padding-top','20px');
// $('#main_panel').css('top','20px');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment