'Opening Instagram app from a link on iOS

I am providing a feed which is consumed by both desktop and mobile apps which contains links to images, users, and tags on Instagram. When these links are clicked on iOS, I want them to open in the Instagram app.

Currently if I have a link like this: https://www.instagram.com/p/BK8f1rigadE/

If I click it in iOS, the Instagram app does open, just briefly. It then seems to launch Safari to the page, which includes an "open in app" link to open it back up in the app. That link uses the "instagram://" protocol to trigger the app to open. I'm aware of that method, but that's not what I'm after.

I'm on iOS 10 with the latest Instagram app. I feel like this used to work, so I'm wondering if it's just a bug in iOS or Instagram that will be fixed eventually.

Links to twitter.com open properly in the Twitter app... that's the kind of behavior I'm after.



Solution 1:[1]

I found a service called URL Genius (via this blog post) that solves this exact problem, and provides click metrics, too.

I don't like relying on an external service for such an important link, but it's easy, works well, and the basic service is free. I will probably set a reminder for myself to check that this still works every month or so...

Solution 2:[2]

Links like this work to open the app: instagram://media?id=1346423547953773636_401375631

However I want a regular http link, which opens a browser on desktop, and the app on mobile. Not sure if it exists.

Solution 3:[3]

From my knowledge, the only supported links into Instagram are described here

I'm not sure what the link you're attempting to use represents: /p/id_here seems like a post? You likely need to use:

https://www.instagram.com/media?id=id_here

The documentation I linked shows the "deeplink" approach (instagram://) which I understand you're avoiding, but the same paths should work through the Universal Link approach, at least from my experience.

Solution 4:[4]

Had the same problem. For me was solved by simply uninstalling and reinstalling the problematic app.

(Instagram 171.0 - iOS 14.3 - iPhone 11 Pro)

Solution 5:[5]

On iOS you must first add the instagram url scheme in the LSApplicationQueriesSchemes key of the info.plist file:

<key>LSApplicationQueriesSchemes</key>
<array>    
    <string>instagram</string> 
</array>

then you can open the url of the post using the link:

instagram://media?id=POST_MEDIA_ID

POST_MEDIA_ID can be found by looking at the page source, you will find a tag like this:

<meta property="al:ios:url" content="instagram://media?id=POST_MEDIA_ID"/>

Obviously, the Instagram app must be installed on the device, otherwise the link will not work.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 0Seven
Solution 2 Josh Santangelo
Solution 3 BHendricks
Solution 4 Jumme
Solution 5 AstrovicApps