iOS6之Smart App Banners推送APP新功能

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">

其中ID为必选。 App ID (required), Affiliate Data (Optional), Argument (Optional) 。

app-id是APP的唯一标识,查询app ID的方法: 访问iTunes Link Maker(http://itunes.apple.com/linkmaker/),在搜索框输入应用名称,选择国家和类型, 在搜索结果列表页面右侧,点击 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 athttp://www.apple.com/itunes/affiliates/.

  • app-argument: (Optional.) 可以使用这个参数传一个id到客户端,如果用户安装了你网站的APP,当他从网站点击进入APP时候会跳转到客户端内相应的页面,这样避免千篇一律,提升了用户体验。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.

app-argument 参数值传递给客户端程序后,作为 UIApplication 委托方法的 url 参数, App 中需添加如下代码进行处理:

-(BOOL)application:(UIApplication*)application
            openURL:(NSURL*)url
            sourceApplication:(NSString*)sourceApplication
            annotation:(id)annotation

格式参考推特的写法:

<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框架内部,否则不起作用。

想了解更多,请参考官方文档https://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html

去年十月有黑客Andrew Plotkin首先爆出iOS6的此功能存在有javascript的安全漏洞,此隐私安全漏洞虽然不是致命性的,但同样引起很多安全领域公司的关注。如果要重现这个bug可以这样来操作:

首先,关闭所有Safari浏览器页面,打开系统设置。

其次,点击进入Safari,下拉到“安全”设置区域,关闭JavaScript。

第三,重新打开Safari,浏览一个带有Smart App Banner功能的网站,如http://store.apple.com。

最后,关闭Safari,重新进入设置-Safari-安全,发现JavaScript在没有通知用户的情况下已经被启用了。

虽然作为大众普通用户,这种安全问题一向被忽视掉,但至少从这次事件我们知道这一新功能是借助iOS系统中Safari浏览器,与其执行了某些javascript功能代码有关。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值