将以下行添加到您的plist文件中:(DemoTest是我的自定义URL架构)
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>DemoTest</string>
<key>CFBundleURLSchemes</key>
<array>
<string>DemoTest</string>
</array>
</dict>
</array>
Run Code Online (Sandbox Code Playgroud)
然后尝试从浏览器URL打开DemoTest://,它将要求您打开已安装的应用程序。
HTML代码:
<html>
<body>
<script type="text/javascript">
window.onload = function() {
// Deep link to your app goes here
document.getElementById("l").src = "DemoTest://";
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>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1812 次 |
| 最近记录: |