Created
April 5, 2013 15:50
-
-
Save dlackty/5320376 to your computer and use it in GitHub Desktop.
Flipboard mobile redirection.
This file contains hidden or 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
<iframe id="appLoader" style="display:none;"></iframe> | |
<script> | |
var flipboardURL = 'flipboard://showSection/flipboard%2Fsingleurl%252Fhttp%253A%252F%252Fwww.wired.com%252Fmagazine%252F2013%252F04%252Ffacebookqa?resetStack=true&referrer=facebook&createDevice=api&canAddToFlipboard=false&createAction=shareWithComment&showPreselectedItem=true'; | |
var appStoreURL = "http://ax.itunes.apple.com/us/app/flipboard/id358801284?mt=8"; | |
var googlePlayURL = "https://play.google.com/store/apps/details?id=flipboard.app&feature=nav_result#?t=W251bGwsMSwyLDNd"; | |
// try and launch Flipboard with the add section url | |
if(navigator.userAgent.match(/android/i) != null){ | |
document.getElementById("appLoader").setAttribute("src", flipboardURL); | |
} | |
if(navigator.userAgent.match(/iPad/i) != null || navigator.userAgent.match(/iPhone/i) != null){ | |
window.location.href = flipboardURL; | |
} | |
// if that failed, quickly try and launch the dont have flipboard URL | |
setTimeout(function(){ | |
window.location.href = 'http://www.wired.com/magazine/2013/04/facebookqa'; | |
},50) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment