Skip to content

Instantly share code, notes, and snippets.

@zackexplosion
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save zackexplosion/f36f605f330ac75e43ec to your computer and use it in GitHub Desktop.

Select an option

Save zackexplosion/f36f605f330ac75e43ec to your computer and use it in GitHub Desktop.
var is_android = navigator.userAgent.toLowerCase().indexOf('android') !== -1;
var is_ios = /iphone|ipad|ipod/i.test( navigator.userAgent);
var link;
var links = {
android : 'https://play.google.com/store?hl=zh-TW',
ios: 'https://itunes.apple.com/tw/genre/ios/id36?mt=8',
default: 'http://google.com'
};
if( is_android ){
link = links.android;
}
else if( is_ios ){
link = links.ios;
}
else{
link = links.default;
}
window.open(link);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment