Created
December 20, 2019 17:23
-
-
Save ayhaadam/53e307fa7b26325b90ae9a172eb80e16 to your computer and use it in GitHub Desktop.
LINE Music App Deep Linking
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
<head> | |
<meta name="viewport" content="width=device-width"> | |
<title>LINE MUSIC22</title> | |
<link rel="shortcut icon" type="image/x-icon" href="https://vos.line-scdn.net/music-img/favicon.png" /> | |
<meta property="og:title" content="LINE MUSIC" /> | |
<meta property="og:type" content="website" /> | |
<meta property="og:url" content="https://music-tw.line.me/" /> | |
<meta property="og:image" content="https://vos.line-scdn.net/music-img/icon167Pt%403x.png" /> | |
<meta property="og:site_name" content="LINE MUSIC" /> | |
<meta property="og:description" content="Enjoy Music on LINE" /> | |
</head> | |
<body> | |
<script> | |
const urlParams = new URLSearchParams(window.location.search); | |
const type = urlParams.get('type'); | |
const dest = urlParams.get('dest'); | |
const tab = urlParams.get('tab'); | |
var uri = 'open'; | |
if (type != null && dest != null) { | |
switch (type) { | |
case 'album': | |
uri = 'albumEnd?albumId=' + dest; | |
break; | |
case 'playlist': | |
uri = 'playlistEnd?playlistId=' + dest; | |
break; | |
case 'artist': | |
uri = 'artistEnd?artistId=' + dest; | |
break; | |
case 'genre': | |
uri = 'genreEnd?genreCode=' + dest; | |
break; | |
case 'theme': | |
uri = 'stationThemeEnd?themeId=' + dest; | |
break; | |
case 'play': | |
uri = 'listen?trackIds=' + dest; | |
break; | |
case 'goto': | |
uri = 'action/go?to=' + dest; | |
break; | |
case 'playVideo': | |
uri = 'playVideo?videoId=' + dest; | |
break; | |
} | |
} | |
if (tab != null && dest == 'main') { | |
uri += ('&tab=' + tab) | |
} | |
if (navigator.userAgent.match(/android/i)) { | |
var timeout, t = 1000, | |
hasApp = true; | |
setTimeout(function () { | |
if (!hasApp) { | |
window.location = ('http://play.google.com/store/apps/details?id=com.linecorp.tw.linemusic'); | |
document.body.removeChild(ifr); | |
} else { | |
document.body.removeChild(ifr); | |
document.location = ('linemusictw://' + uri + '&openExternalBrowser=1'); | |
} | |
}, 2000); | |
var t1 = Date.now(); | |
var ifr = document.createElement("iframe"); | |
ifr.setAttribute('src', 'linemusictw://' + uri + '&openExternalBrowser=1'); | |
ifr.setAttribute('style', 'display:none'); | |
document.body.appendChild(ifr); | |
timeout = setTimeout(function () { | |
var t2 = Date.now(); | |
if (!t1 || t2 - t1 < t + 10) { | |
hasApp = false; | |
} | |
}, t); | |
} else if (navigator.userAgent.match(/(iphone|ipad|ipod);?/i)) { | |
var timeout, t = 1000, | |
hasApp = true; | |
setTimeout(function () { | |
if (!hasApp) { | |
window.location = ('https://itunes.apple.com/app/id1459249212'); | |
windows.body.removeChild(ifr); | |
} else { | |
windows.location = ('linemusictw://' + uri + '&openExternalBrowser=1'); | |
document.body.removeChild(ifr); | |
} | |
}, 2000); | |
var t1 = Date.now(); | |
var ifr = document.createElement("iframe"); | |
ifr.setAttribute('src', 'linemusictw://' + uri + '&openExternalBrowser=1'); | |
ifr.setAttribute('style', 'display:none'); | |
document.body.appendChild(ifr); | |
timeout = setTimeout(function () { | |
var t2 = Date.now(); | |
if (!t1 || t2 - t1 < t + 20) { | |
hasApp = false; | |
} | |
}, t); | |
} else { | |
window.location = ('https://music-tw.line.me'); | |
} | |
</script> | |
Redirect To APP | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment