2015-05-19 28 views
0

我們在網絡和iPhone上。我們希望將電子郵件發送給客戶(交易,例如「您的訂單已發貨」),並讓他們點擊以獲取更多信息,無論是在應用程序還是在網站上。如何爲URL架構鏈接設置重新路由?

  • 如果客戶安裝了應用程序並且在iPhone上,我們希望將它們發送到應用程序。
  • 否則,我們要將它們路由到Web應用程序的URL。

在高層次或產品層面,它是如何工作的?我試圖瞭解這是否可行,或者正確的流程是什麼。

電子郵件的鏈接是一樣的東西

<a href="http://oursite.com/routing-logic?path/to/destination">link</a> 

路由邏輯確實像

if ourschema:// can open, then open the app (they have the app & are on the device) 

else, go to https://oursite.com/path/to/destination 

這是基本上是如何URL架構路由的作品?我聽說有關網頁是否可以測試某個設備是否支持給定URL架構的衝突信息。

回答

2

我認爲這是your case

添加郵件鏈接到簡單的頁面,即檢查用戶代理和有腳本:

<script language="javascript"> 
var timeout; 
function open_webapp() { 
    window.location='https://oursite.com/path/to/destination'; 
} 

function try_to_open_app() { 
    timeout = setTimeout('open_webapp()', 300); 
} 
</script> 
<a onClick="javascript:try_to_open_app();" href="yourappurl:">App name</a> 

哪裏是簡單url-scheme tutorial