-
-
Save skylying/a77ddbafb3d179b4001fbe3b81567e0a to your computer and use it in GitHub Desktop.
Detect mobile Platform
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
<a class="btndefault" onclick="iosButton();" >下载</a></li> | |
function iosButton(){ | |
//分辨是哪個裝置 | |
var u = navigator.userAgent; | |
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android | |
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 | |
if(isiOS) { | |
//紀錄下載 | |
gtag('event', 'click', {'event_category':'click_ios_installation'}); | |
window.location.replace(data_ios); | |
}else{ | |
success_msg_show('请使用ios装置点击此连结'); | |
if($(window).width() < 768){ | |
alert('目前尚未提供Android版本,请用ios装置点击下载'); | |
} | |
} | |
} // end of iosButton |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment