带有元标记的应用程序 link 页面不起作用
App link page with meta tags not working
我已经设置了一个带有应用程序 link 元标记的网页以重定向到我的应用程序或网站。如果我在浏览器中直接在 iphone 上键入 url 方案(在浏览器中键入 myapp:// 会启动该应用程序),则 url 方案有效。然后我设置了以下网页:
<html>
<head>
<meta property="al:ios:url" content="myapp://" />
<meta property="al:iphone:url" content="myapp://" />
<meta property="al:ios:app_name" content="My App" />
<meta property="al:web:url" content="http://myapp.com" />
</head>
<body>
Hello, world!
</body>
</html>
网站只是加载页面,不会启动应用程序或重定向到主页。
那些 <meta>
标签仅供 Facebook 爬虫使用。 Safari 等移动浏览器完全忽略它们。你需要使用 JavaScript 这样的东西:
setTimeout(function() {
window.location = "https://itunes.apple.com/path/to/your/app/";
}, 25);
// If "yourapp://" is registered, your app will launch immediately and the
// timer won't fire. If not, you'll get an ugly "Cannot Open Page"
// dialogue and then the App Store will launch
window.location = "yourapp://";
显然这不是一个理想的解决方案,它有 吨 讨厌的边缘情况。如, you'd be much happier with a service like Branch.io
所述
我已经设置了一个带有应用程序 link 元标记的网页以重定向到我的应用程序或网站。如果我在浏览器中直接在 iphone 上键入 url 方案(在浏览器中键入 myapp:// 会启动该应用程序),则 url 方案有效。然后我设置了以下网页:
<html>
<head>
<meta property="al:ios:url" content="myapp://" />
<meta property="al:iphone:url" content="myapp://" />
<meta property="al:ios:app_name" content="My App" />
<meta property="al:web:url" content="http://myapp.com" />
</head>
<body>
Hello, world!
</body>
</html>
网站只是加载页面,不会启动应用程序或重定向到主页。
那些 <meta>
标签仅供 Facebook 爬虫使用。 Safari 等移动浏览器完全忽略它们。你需要使用 JavaScript 这样的东西:
setTimeout(function() {
window.location = "https://itunes.apple.com/path/to/your/app/";
}, 25);
// If "yourapp://" is registered, your app will launch immediately and the
// timer won't fire. If not, you'll get an ugly "Cannot Open Page"
// dialogue and then the App Store will launch
window.location = "yourapp://";
显然这不是一个理想的解决方案,它有 吨 讨厌的边缘情况。如