URLスキームは、iDeviceにアプリケーションがインストールされている場合にのみ有効です。インストールされていない場合は、エラーが発生します。
1)この機能を実装するには、アプリがインストールされているかどうかを検出するウェブページに、電子メールリンクからリダイレクトする必要があります。このwww.yourwebsite/detectappような何か
2)あなたのdetectappページはjavascript-
var appstoreFail = "www.your_redirect_website.com";
//Check is device is iOS
var iOS = /(iPad|iPhone|iPod)/.test(navigator.userAgent);
var appUrlScheme = "xyz_app://";
if (iOS) {
// If the app is not installed the script will wait for 2sec and redirect to web.
var loadedAt = +new Date;
setTimeout(function() {
if (+new Date - loadedAt < 2000)
window.location = appstoreFail;
} ,25);
// Try launching the app using URL schemes
window.open(appUrlScheme, "_self");
} else {
// Launch the website
window.location = appstoreFail;
}
オーケーを持つことになります。ありがとう。私はこれを試してみる。 –
setTimoutが2秒に直接設定されていない特定の理由はありますか? –