序号 | 录入时间 | 录入人 | 备注 |
---|---|---|---|
1 | 2015-05-07 | Alfred Jiang | - |
2 | 2015-12-23 | Alfred Jiang | - |
应用间通信 - 通过 URL 检测是否安装并打开应用
应用间通信 \ URL \ Web \ 邮件打开App \ Schema
- 需要通过 URL 检测是否安装应用,如果已安装则打开应用,如果未安装则跳转到下载页面
在 .plist 文件添加如下字段
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string></string>
<key>CFBundleURLSchemes</key>
<array>
<string>GJApplication</string>
</array>
</dict>
</array>
- GJApplication 替换为自定义名称
- 示例一
<body>
<div>
Click to open GJ App
<br />
<a href="REXApplication://com.acme.ToDoList"></a>
<a onClick="javascript:try_to_open_app();" href="REXApplication://com.acme.ToDoList">Open GJ App</a>
</div>
<script language="javascript">
var timeout;
function open_appstore() {
window.location='http://itunes.apple.com/cn/app/id950554426?mt=8';
}
function try_to_open_app() {
timeout = setTimeout('open_appstore()', 300);
}
</script>
</body>
- 示例二
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
window.onload = function() {
// Deep link to your app goes here
document.getElementById("l").src = "REXApplication://";
setTimeout(function() {
// Link to the App Store should go here -- only fires if deep link fails
window.location = "http://www.pgyer.com/irex";
}, 300);
};
</script>
<iframe id="l" width="1" height="1" style="visibility:hidden"></iframe>
</body>
</html>
- REXApplication://com.acme.ToDoList 中 com.acme.ToDoList 可设置为自定义参数
- http://itunes.apple.com/cn/app/id950554426?mt=8 替换为实际安装地址(如果是 AppStore 安装,替换 id950554426 即可)
(无)
(无)