我已经创建了一个 iPad 应用程序。
我想从 safari 启动它。使用 URL Schema,它已成功完成。
我想从我的申请中发送一个链接。单击哪个应该打开我的应用程序。
我发送的邮件包含以下内容
CLICK HERE TO LAUNCH APP
这是一个 href = "MyApp://someString"的 anchor 标签。
但是当我将其作为邮件发送时,在 iPad 配置的邮件上,链接工作正常,但在浏览器中它不起作用。后来我才知道 Yahoo、Gmail 会停用 http://
现在,我想用 URL 架构 MyApp://
打开我的应用程序,使用 HTML Onload 类似于打开 itunes.apple.com 时在我们的 PC 中打开 iTunes
使用 windows.open('MyApp://')
时,在 onload()
函数中,我的应用程序也没有启动。
该怎么做? 如何在加载 html 时启动我的应用程序?
最佳答案
像这样制作一个 PHP 页面:
<?php
header("Location: MyApp://somestring;")(
?>
<html>
<head>
<meta http-equiv="Refresh" content="0; MyApp://somestring" />
<title>Opening App...</title>
<script>
function openApp() {
window.location.href = "MyApp://somestring";
}
</script>
</head>
<body onload="openApp();">
<a href="MyApp://somestring">Click here if app doesn't open...</a>
</body>
</html>
关于javascript - 从 html onload 启动 iPhone 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11180220/