Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lukasbestle
Created August 2, 2013 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukasbestle/6142633 to your computer and use it in GitHub Desktop.
Save lukasbestle/6142633 to your computer and use it in GitHub Desktop.
// 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