元标记不起作用的应用链接页面

问题描述:

我已经设置了带有应用链接元标记的网页,以重定向到我的应用或网站。如果我在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://"; 

显然,这不是一个理想的解决方案,它具有讨厌的边缘案件。正如在my answer to your other question中所提到的,你会更喜欢Branch.io

+0

这样的服务谢谢,是的,我终于明白了应用程序链接。 Branch.io看起来不错,只是无法编译它 – rEquation

+0

让我知道是否有什么我可以做的帮助。分支也有[令人敬畏的支持](https://support.branch.io)! –

+0

感谢所有现在的工作。使用branch.io到底更容易 – rEquation