[英]Is it possible to open an Native iOS app by using Custom url scheme without a webpage directs to custom url?
我正在嘗試通過單擊電子郵件中的鏈接來打開本機 iOS 應用程序。 我使用過“自定義網址方案”。 如果我在 safari 瀏覽器中輸入“test://”,那么我的原生 iOS 應用程序就會打開。 但是,如果我單擊電子郵件中的鏈接“test://”,那么它會以 http 為前綴,例如“ http://test// ”,並且不會打開 iOS 應用程序。 我瀏覽了很多鏈接,發現"iOS needs a Webpage which will redirect to custom url of native iOS App"
來打開一個應用程序。 Is it possible to open an app from email link without using a webpage redirects to app?
提前,感謝您的幫助!
簡單的答案可能是否定的,因為您幾乎無法控制單個應用程序將如何處理鏈接。 復雜的答案是你應該做些什么。 請注意,它並不總是需要返回完整的網頁——在帶有 Chrome 的 Android 上,您可以直接觸發 307 重定向到 Chrome 意圖。
您可以設置一個簡單的 Web 服務器,在 ping 時返回 `window.location = 'test://'。
或者更好的是,如果應用程序不存在,您可以嘗試在 iframe 中打開 URI 方案,然后回退到 Web URL。 這可以使用以下機制來實現:
下面是一個客戶端 javascript 的例子:
<script type="text/javascript">
window.onload = function() {
// Deep link to your app goes here
document.getElementById("l").src = "my_app://";
setTimeout(function() {
// Link to the App Store should go here -- only fires if deep link fails
window.location = "https://itunes.apple.com/us/app/my.app/id123456789?ls=1&mt=8";
}, 500);
};
</script>
<iframe id="l" width="1" height="1" style="visibility:hidden"></iframe>
這正是我們在我的公司branch.io 所做的。 我們一直在處理瀏覽器和 web 視圖的變化,因為總是有新的場景需要覆蓋。 在決定如何將用戶深層鏈接到您的應用時,必須查看用戶代理字符串。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.