如果您的电子邮件中包含iframe
的网页,并且src
设置为您的应用的自定义方案,则iOS会自动重定向到应用中的该位置。如果应用程序未安装,则不会发生任何事情。这允许您深入链接到应用程序(如果它已安装),或者如果未安装,则重定向到App Store。
例如,如果您安装了twitter应用程序,并导航到包含以下标记的网页,您将立即转到该应用程序。如果您没有安装Twitter应用程序,则会看到文字“Twitter应用程序未安装”。
<!DOCTYPE html>
<html>
<head>
<title>iOS Automatic Deep Linking</title>
</head>
<body>
<iframe src="twitter://" width="0" height="0"></iframe>
<p>The Twitter App is not installed</p>
</body>
</html>
这里,如果没有安装应用程序重定向到App Store进行更彻底的例子:
<!DOCTYPE html>
<html>
<head>
<title>iOS Automatic Deep Linking</title>
<script src='//code.jquery.com/jquery-1.11.2.min.js'></script>
<script src='//mobileesp.googlecode.com/svn/JavaScript/mdetect.js'></script>
<script>
(function ($, MobileEsp) {
// On document ready, redirect to the App on the App store.
$(function() {
if (typeof MobileEsp.DetectIos !== 'undefined' && MobileEsp.DetectIos()) {
// Add an iframe to twitter://, and then an iframe for the app store
// link. If the first fails to redirect to the Twitter app, the
// second will redirect to the app on the App Store. We use jQuery
// to add this after the document is fully loaded, so if the user
// comes back to the browser, they see the content they expect.
$('body').append('<iframe class="twitter-detect" src="twitter://" />')
.append('<iframe class="twitter-detect" src="itms-apps://itunes.com/apps/twitter" />');
}
});
})(jQuery, MobileEsp);
</script>
<style type="text/css">
.twitter-detect {
display: none;
}
</style>
</head>
<body>
<p>Website content.</p>
</body>
</html>
我认为理想的解决方案将意味着你可以重定向到iTunes的链接与指令。就像:https://itunes.apple.com/us/app/clear/id492134154?mt=8&uo=4&open=true where open = true告诉iOS应用程序商店打开应用程序... – ConfusedNoob