Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Instagram "Open in app" button?

I'm doing an app in angular 1.4.2 and want to mimic the behaviour of instagram mobile web to open the app, when I tap on the button the instagram is opened, is that possible?

enter image description here

I already tried the solutions on older posts but none seemed to work. I don't know if it's an angular problem or that they don't work anymore. Older posts:

  • Open Instagram from Android Browser
  • Link on a webpage to open instagram app

More details of what I tried and didn't worked:

<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>
like image 338
Agu V Avatar asked Feb 15 '17 15:02

Agu V


1 Answers

I tried further and this link end up working.

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

Also I had to add to remove the "unsafe:" tag that angular was adding.

var app = angular.module( 'myApp', [] )
.config( [
    '$compileProvider',
    function( $compileProvider )
    {   
     $compileProvider.aHrefSanitizationWhitelist(/^\s*(http|https?|local|data|instagram):/);
    }
]);
like image 117
Agu V Avatar answered Oct 14 '22 07:10

Agu V