Android 网页上的链接以打开 Instagram 应用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21295051/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 04:18:13  来源:igfitidea点击:

Link on a webpage to open instagram app

androidinstagram

提问by Sébastien Richer

Is there a way to setup a link on a webpage, so that it tries to open the instagram app. (if it's installed)?

有没有办法在网页上设置链接,以便它尝试打开 Instagram 应用程序。(如果已安装)?

I'm trying to do this for a responsive website so I'm not in another "app".

我正在尝试为响应式网站执行此操作,因此我不在另一个“应用程序”中。

This does not work:

这不起作用:

<div>
    <a href="instagram//:media?id=434784289393782000_15903882">instagram://media?id=434784289393782000_15903882</a>
</div>

EDIT: I've corrected the typo as suggested in the answers and tested on iPhone. Work fine! Thanks @Krisrak! But I'm testing on Android Galaxy Nexus and it does not work. I see 2 messages, first "You must log out in order to reset your password." then it fades out and I see another saying "Sorry, we weren't able to load that link.".

编辑:我已经按照答案中的建议更正了拼写错误并在 iPhone 上进行了测试。工作正常!谢谢@Krisrak!但我正在 Android Galaxy Nexus 上进行测试,但它不起作用。我看到 2 条消息,首先是“您必须注销才能重置密码。” 然后它淡出,我看到另一个说“对不起,我们无法加载该链接。”。

Thanks!

谢谢!

采纳答案by krisrak

You have a typo the href should be ://not //:

你有一个错字在href应该是:////:

<div>
<a href="instagram://media?id=434784289393782000_15903882">instagram://media?id=434784289393782000_15903882</a>

回答by Chemical Programmer

1st Method

第一种方法

<a href="http://instagram.com/_u/{USERNAME}/">Link to Instagram Page</a>

<a href="http://instagram.com/_u/{USERNAME}/">Link to Instagram Page</a>

  • Ask user to select application to launch with
  • 要求用户选择要启动的应用程序


2nd Method

方法二

<a href="instagram://user?username={USERNAME}">Link to Instagram Profile</a>

<a href="instagram://user?username={USERNAME}">Link to Instagram Profile</a>

  • If user installedinstagram application : Directly launch page with native application
  • If user not installedinstagram application : Do nothing
  • 如果用户安装了Instagram 应用程序:使用本机应用程序直接启动页面
  • 如果用户未安装Instagram 应用程序:什么都不做


Tested on Android 4.4 Chrome

在 Android 4.4 Chrome 上测试

回答by Phúc Hoàng Tr??ng

For Android, you can try use this ( both for Chrome and Android's browser)

对于 Android,您可以尝试使用这个(Chrome 和 Android 的浏览器)

intent://instagram.com/_n/mainfeed/#Intent;package=com.instagram.android;scheme=https;end

e.g:

例如:

<a href="intent://instagram.com/_n/mainfeed/#Intent;package=com.instagram.android;scheme=https;end"> test open Instagram ANDROID</a>

回答by Koushan

For browsers in android, if you want to link to a specific instagram page, try this:

对于 android 中的浏览器,如果您想链接到特定的 Instagram 页面,请尝试以下操作:

<a href="http://instagram.com/_u/USERNAME/">visit our instagram page</a>

回答by undefinedtoken

Try this :

尝试这个 :

Works 100% <a href="instagram://user?username=untitled.tiff">untitled.tiff</a>

工作 100% <a href="instagram://user?username=untitled.tiff">untitled.tiff</a>

untitled.tiff

无题.tiff

回答by user3784554

Unfortunately, UC browser and Mozilla Firefox do not open native app via url, but , Chrome and default browser or htmlviewer in android does open the the native instagram android app

不幸的是,UC 浏览器和 Mozilla Firefox 不通过 url 打开本机应用程序,但是,Chrome 和默认浏览器或 android 中的 htmlviewer 确实打开了本机 instagram android 应用程序

try following links in chrome browser(Android)/ native HtmlViewer :

尝试在 chrome 浏览器(Android)/本机 HtmlViewer 中使用以下链接:

<a href="http://instagram.com/p/">Open Instagram</a>
<a href="https://instagram.com/p/">Open Instagram</a>

<a href="http://instagr.am/p/">Open Instagram</a>
<a href="https://instagr.am/p/">Open Instagram</a>