Skip to content

Instantly share code, notes, and snippets.

@dlackty
Created April 5, 2013 15:50
Show Gist options
  • Save dlackty/5320376 to your computer and use it in GitHub Desktop.
Save dlackty/5320376 to your computer and use it in GitHub Desktop.
Flipboard mobile redirection.
<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