iOS6新標籤apple-itunes-app提供了一個叫 Smart App Banners的功能, 當你在iOS移動平台訪問一個網站時,會提示你去App Store下載這個網站的官方App。
Smart App Banners自動識別使用者裝置是否支援該應用APP,如果裝置不相容,則下載廣告條不會顯示。
文法格式為:
meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL"> <meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">
其中ID為必選。 App ID (required), Affiliate Data (Optional), Argument (Optional) 。
app-id是APP的唯一標識,查詢app ID的方法: 訪問iTunes Link Maker 在搜尋方塊輸入應用程式名稱,選擇國家和類型, 在搜尋結果列表頁面右側,點擊 iPhone App Link,跳轉的URL中id 和 ?mt之間的9為數字就是這個APP的唯一ID。
其他可選屬性的介紹:
affiliate-data: (Optional.) Your iTunes affiliate string, if you are an iTunes affiliate. If you are not, find out more about becoming an iTunes affiliate at app-argument: (Optional.) A URL that provides context to your native app. If you include this, and the user has your app installed, she can jump from your website to the corresponding position in your iOS app. Typically, it is beneficial to retain navigational context because:
If the user is deep within the navigational hierarchy of your website, you can pass the document’s entire URL, and then parse it in your app to reroute her to the correct location in your app.
If the user performs a search on your website, you can pass the query string so that she can seamlessly continue the search in your app without having to retype her query.
If the user is in the midst of creating content, you can pass the session ID to download the web session state in your app so she can nondestructively resume her work.
You can generate the app-argument of each page dynamically with a server-side script. You can format it however you'd like, as long as it is a valid URL.
格式參考推特的寫法:
meta name="apple-itunes-app" content="app-id=333903271, app-argument=twitter://timeline, affiliate-data=partnerId=30&siteID=UkOLawSuc90&u1=tw-
44c06a9f3dde70bac326583e550d2f3dafd9cf56a0f96e6e639cf2155">
<meta name="apple-itunes-app" content="app-id=333903271, app-argument=twitter://timeline, affiliate-data=partnerId=30&siteID=UkOLawSuc90&u1=tw-44c06a9f3dde70bac326583e550d2f3dafd9cf56a0f96e6e639cf2155">
需要注意的是Smart App Banners標籤不能用在frame架構內部,否則不起作用。