【问题标题】:How to make Instagram "Open in app" button?如何使 Instagram 的“在应用程序中打开”按钮?
【发布时间】:2017-02-15 15:56:44
【问题描述】:

我正在做一个 Angular 1.4.2 的应用程序,并想模仿 instagram 移动网络的行为来打开应用程序,当我点击按钮时 instagram 被打开,这可能吗?

我已经尝试过旧帖子的解决方案,但似乎都没有。我不知道这是一个角度问题还是他们不再工作了。 较早的帖子:

更多关于我尝试过和没有成功的细节:

<a href="instagram://media?id=434784289393782000_15903882">instagram://media?id=434784289393782000_15903882</a>
<a href="http://instagram.com/_u/{USERNAME}/">Link to Instagram Page</a>
<a href="instagram://user?username={USERNAME}">Link to Instagram Profile</a>
<a href="intent://instagram.com/_n/mainfeed/#Intent;package=com.instagram.android;scheme=https;end"> test open Instagram ANDROID</a>
<a href="http://instagram.com/_u/USERNAME/">visit our instagram page</a>
<a href="instagram://user?username=untitled.tiff">untitled.tiff</a>
<a href="instagram://app">Open Instagram</a>

【问题讨论】:

  • “似乎没有工作”不足以描述问题。发布您使用的代码以及究竟发生了什么。
  • 在您发布的链接中,2. 打开应用选择(instagram / chrome),3. 工作正常,4. 也可以(意图链接),5. 还打开选择 - 在最新的 Chrome 上测试Android 6.0.1
  • 你是对的,我一定是做错了什么,现在它的工作编号为 3。非常感谢!

标签: javascript html angularjs instagram


【解决方案1】:

我进一步尝试,这个链接最终工作了。

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

我还必须添加以删除 angular 添加的“不安全:”标签。

var app = angular.module( 'myApp', [] )
.config( [
    '$compileProvider',
    function( $compileProvider )
    {   
     $compileProvider.aHrefSanitizationWhitelist(/^\s*(http|https?|local|data|instagram):/);
    }
]);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-07-06
    • 1970-01-01
    • 2015-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多