Created
March 17, 2012 12:55
-
-
Save samrayner/2058607 to your computer and use it in GitHub Desktop.
Serve splash images for iPhone/iPad models
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
(function () { | |
var width = 320; //default to non-retina iPhone | |
var height = 460; | |
if(navigator.platform === 'iPad') { | |
if(window.orientation === 90 || window.orientation === -90) { | |
width = 1024; //landscape | |
height = 748; | |
} | |
else { | |
width = 768; //portrait | |
height = 1004; | |
} | |
} | |
if(window.devicePixelRatio === 2) { | |
width *= 2; | |
height *= 2; | |
} | |
document.write('<link rel="apple-touch-startup-image" href="images/splash-'+width+'x'+height+'.png"/>' ); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment