roh*_*son 9 android deep-linking ios
我试图通过URL(通过电子邮件等共享)启动我的本机应用程序.似乎Android仅响应HTTP深层链接URL(例如,http://myapp.com/stuff),并且iOS仅响应非HTTP自定义深层链接URL(例如,myapp:// stuff).有没有人找到一个解决方案来让两个操作系统打开相同的URL?
此外,iOS是否可以使用HTTP深层链接URL?类似于http://youtu.be将如何打开本机iOS应用程序.Facebook也这样做.
谢谢!:)
本文对“iOS 和 Android 的 URL 方案”很有用:http://fokkezb.nl/2013/09/20/url-schemes-for-ios-and-android-2/
编辑:向用户发送网站链接的主要思想。使用服务器上的平台检测我们可以返回正确的链接:
function open() {
// If it's not an universal app, use IS_IPAD or IS_IPHONE
if (IS_IOS) {
window.location = "myapp://view?id=123";
setTimeout(function() {
// If the user is still here, open the App Store
if (!document.webkitHidden) {
// Replace the Apple ID following '/id'
window.location = 'http://itunes.apple.com/app/id1234567';
}
}, 25);
} else if (IS_ANDROID) {
// Instead of using the actual URL scheme, use 'intent://' for better UX
window.location = 'intent://view?id=123#Intent;package=my.app.id;scheme=myapp;launchFlags=268435456;end;';
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2991 次 |
| 最近记录: |