【发布时间】:2016-01-16 01:06:18
【问题描述】:
我的 html 页面上有这个链接,可以在特定用户上打开 Instagram 应用程序:
<a href="instagram://user?username={USERNAME}">Link to Instagram Profile</a>
我正在寻找自动运行 url 'instagram://user?username={USERNAME}' 的方法(如自动重定向)。
这是我在头脑中尝试过的:
1.
<meta http-equiv="refresh" content="0; url=instagram://user?username={USERNAME}" />
2.
<script type="text/javascript">
window.location.href = "instagram://user?username={USERNAME}"
</script>
3。 @Nitin-bagoriya 建议的变化
<script> function load() { window.location.href = "instagram://user?username={USERNAME}"}; window.onload = load; </script>
-
@Giuseppe 建议的变体
addEventListener('load', load);
但是当我在那里浏览时 - 什么也没有发生。 它在安装了 instagram 应用程序的 Android 上进行了测试。
我想知道有没有办法通过重定向自动运行 Instagram 应用程序,这样用户就不需要点击链接了?
【问题讨论】:
-
稍后您将使用 ux-检查是否定义了 instagram,不是吗?在开发时,您可以在未定义 instagram 的情况下发出警报,因此您知道它会按预期流动。
-
@Giuseppe,抱歉不确定定义的含义,但只有安装了 instagram 应用程序的用户才能登陆此页面。
-
那就没必要了。完美:)
标签: javascript android html url-redirection http-redirect