我在做什么
我正在創建一個 Web 表單,該表單用作 QR 碼來打開安裝在 android/IOS 手機中的應用程式。當用戶掃描二維碼時,手機會運行網頁表單,網頁表單會檢查手機內部是否安裝了應用程式,如果安裝了應用程式,網頁表單會打開應用程式,如果沒有則打開谷歌根據所使用的作業系統系統播放商店/應用商店網頁。
我的問題
現在我的問題是我不知道觸發/打開它的應用程式的名稱/ID 是什么,我唯一知道的關于該應用程式的資訊是它在設定和主螢屏中被稱為 Rymtime。該應用程式的 google Play 商店鏈接在
我試過的
我試圖將其名稱直接放入代碼中:
window.location = "Rymtime://";
我還嘗試將在其 google Play 商店網站“www...id=com.time2clock.wai.timeemployee”中找到的“id”東西放入
window.location = "com.time2clock.wai.timeemployee://";
我的代碼
我根據這個堆疊溢位問題創建了我的代碼。
下面是我的代碼:
<body>
...
<button name="data1" type="button" onclick="getOS()">Click</button> //I use button to test out the function
...
</body>
<script type="text/javascript">
function getOS() {
var userAgent = window.navigator.userAgent,
platform = window.navigator.platform,
windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'], //as I do not own an Iphone I use this to test out the IOS part
iosPlatforms = ['iPhone', 'iPad', 'iPod'],
os = null;
if (iosPlatforms.indexOf(platform) !== -1) {
ios();
} else if (windowsPlatforms.indexOf(platform) !== -1) {
ios(); //as I do not own an Iphone I use this to test out the IOS part
} else if (/Android/.test(userAgent)) {
android();
}
}
function ios() {
setTimeout(function () { window.location = "https://apps.apple.com/my/app/rymtime/id1447217174"; }, 25);
window.location = "Rymtime://"; //I do not test this part because I do not own an Iphone an I am using window to see if the code is being executed, I only check if the website above is runned
}
function android() {
setTimeout(function () { window.location = "https://play.google.com/store/apps/details?id=com.time2clock.wai.timeemployee"; }, 25);
window.location = "Rymtime://"; //The application is not executed thus it redirect to the play store page.
}
</script>
順便說一句,手機中安裝的應用程式的位置與其他應用程式的位置相同嗎?像這樣:
somefile\somefile\packageName
或者像這樣:
Username(differ)\somefile\somefile\packageName
謝謝。
uj5u.com熱心網友回復:
我不確定 IOS 是什么,但我發現我可以&launch=true在應用程式的 google Play 商店頁面的 URL 末尾添加以啟動應用程式(如果已安裝)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/381500.html
標籤:javascript 安卓 iPhone 网络表格
