Created
May 10, 2017 10:07
-
-
Save i8degrees/27b34dfbf7fdfcd7862a2b118fb35ce4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//- partials/_safari-web-app.pug:jeff | |
//- | |
//- https://gist.github.com/kylebarrow/1042026 | |
//- http://stackoverflow.com/questions/2898740/iphone-safari-web-app-opens-links-in-new-window | |
script(). | |
'use strict'; | |
var script = document.createElement('script'); | |
script.innerHTML = `(function(standalone) { | |
if(!standalone) { | |
return; | |
} | |
document.addEventListener('click', function(evt) { | |
var element = evt.target, | |
href = ''; | |
while(!/^(a|html)$/i.test(element.nodeName)) { | |
element = element.parentNode; | |
} | |
if(element.getAttribute) { | |
href = element.getAttribute('href'); | |
if('' !== href && '#' !== href && null !== href && (!element.protocol || element.protocol !== 'tel:')) { | |
evt.preventDefault(); | |
window.location = element.href; | |
} | |
} | |
}, false); | |
}(window.navigator.standalone));` | |
document.head.appendChild(script); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//- HTML5 doctype | |
doctype html | |
html(lang='en') | |
head | |
append meta | |
meta(name='apple-mobile-web-app-capable', content='yes') | |
meta(name='apple-mobile-web-app-status-bar-style', content='black-translucent') | |
meta(name='apple-mobile-web-app-title', content='Naughty Girl | naughty.im') | |
include partials/_safari-web-app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment