|
1 | 1 | <html>
|
| 2 | + |
2 | 3 | <head>
|
3 |
| - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
4 |
| - <meta name="viewport" content="width=device-width,minimum-scale=1.0, maximum-scale=1.0" /> |
5 |
| - <title>Kaki Verify</title> |
6 |
| - <style>@media screen and (max-device-width:480px){body{-webkit-text-size-adjust:none}}</style> |
| 4 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 5 | + <meta name="viewport" content="width=device-width,minimum-scale=1.0, maximum-scale=1.0" /> |
| 6 | + <title>Kaki Verify</title> |
| 7 | + <style> |
| 8 | + @media screen and (max-device-width:480px) { |
| 9 | + body { |
| 10 | + -webkit-text-size-adjust: none |
| 11 | + } |
| 12 | + } |
| 13 | + </style> |
7 | 14 |
|
8 |
| - <!-- implement javascript on web page that first first tries to open the deep link |
| 15 | + <!-- implement javascript on web page that first first tries to open the deep link |
9 | 16 | 1. if user has app installed, then they would be redirected to open the app to specified screen
|
10 | 17 | 2. if user doesn't have app installed, then their browser wouldn't recognize the URL scheme
|
11 | 18 | and app wouldn't open since it's not installed. In 1 second (1000 milliseconds) user is redirected
|
12 | 19 | to download app from app store.
|
13 | 20 | -->
|
14 |
| - <script> |
| 21 | + <script> |
| 22 | + var getQueryString = function ( field, url ) { |
| 23 | + var href = url ? url : window.location.href; |
| 24 | + var reg = new RegExp( '[?&]' + field + '=([^&#]*)', 'i' ); |
| 25 | + var string = reg.exec(href); |
| 26 | + return string ? string[1] : null; |
| 27 | + }; |
15 | 28 | window.onload = function() {
|
16 |
| - <!-- Deep link URL for existing users with app already installed on their device --> |
17 |
| - window.location = 'kaki://join?screen=xxxxx'; |
18 |
| - <!-- Download URL (TUNE link) for new users to download the app --> |
19 |
| - setTimeout("window.location = 'https://play.google.com/store/apps/details?id=app.kaki';", 1000); |
| 29 | + |
| 30 | + debugger; |
| 31 | + var package = getQueryString('app'); // returns 'chicken' |
| 32 | + var sportId = getQueryString('sport'); // returns 'sandwich' |
| 33 | + var code = getQueryString('code'); // returns null |
| 34 | + |
| 35 | + <!-- Deep link URL for existing users with app already installed on their device --> |
| 36 | + var finalDeeplink = 'kaki://join?'+sportId+'#'+code; |
| 37 | + alert(finalDeeplink); |
| 38 | + window.location = finalDeeplink; |
| 39 | + |
| 40 | + <!-- Download URL for new users to download the app --> |
| 41 | + setTimeout("window.location = 'https://play.google.com/store/apps/details?id=app.kaki';", 1000); |
20 | 42 | }
|
21 |
| - </script> |
| 43 | + </script> |
22 | 44 | </head>
|
| 45 | + |
23 | 46 | </html>
|
0 commit comments