Created
August 2, 2013 19:22
-
-
Save lukasbestle/6142633 to your computer and use it in GitHub Desktop.
A vanilla JS implementation for http://blog.imusr.de/codeschnipsel-ios-version-abhaengige-statusbar-via-jquery/
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
// Check iOS Version and change the META | |
window.onload = function() { | |
var iOSVersion; | |
if (/iP(hone|od|ad)/.test(navigator.platform)) { | |
// supports iOS 2.0 and later | |
var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/); | |
iOSVersion = [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)]; | |
iOSVersion = parseInt(iOSVersion[0]); | |
} | |
if (iOSVersion >= 7) { | |
color = 'black-translucent'; | |
} else { | |
color = 'black'; | |
} | |
// Create a new element | |
tag = document.createElement('meta'); | |
tag.name = 'apple-mobile-web-app-status-bar-style'; | |
tag.content = color; | |
document.getElementsByTagName('head')[0].appendChild(tag); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment