Last active
July 12, 2017 05:23
-
-
Save critzjm/3b60ceef5bc936de1aedfab703ffe3a6 to your computer and use it in GitHub Desktop.
Hide website header, nav and footer when viewing it from an iOS app
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
document.addEventListener('DOMContentLoaded', function() { | |
var userAgent = window.navigator.userAgent.toLowerCase(), | |
safari = /safari/.test(userAgent), | |
ios = /iphone|ipod|ipad/.test(userAgent); | |
if(ios) { | |
if (!safari) { | |
// ios webview | |
document.getElementById("header").style.display = "none"; | |
document.getElementById("nav-toggle").style.display = "none"; | |
document.getElementById("footer").style.display = "none"; | |
}; | |
}; | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment