Open social media links to app if installed else open browser iOS and Android Xamrin forms

Dipannita Das 21 Reputation points
2022-06-03T07:48:47.477+00:00

Webpage with social media links loading inside WebView. On tapping on social media link how to open respective app if installed else browser

<a href="https://twitter.com/subaru_usa?lang=en" target="_blank">Twitter</a>

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,301 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 36,951 Reputation points Microsoft Vendor
    2022-06-09T08:15:58.5+00:00

    Hello,

    You could use this event Navigating in WebView to resolve your issue.

    Sample:

       <WebView x:Name="webview" Navigating="webview_Navigating">  
    

    Important: For using Navigating, you need to delete target="_blank" in your <a> lable.

    Next, we need to make the app to respond to URLs on websites. In fact, we could use App-link to implement this function effectively.

    On Android, we could use App-link to let Android raise a disambiguation dialog to ask a user what application to select the application.

    On iOS, we could use Universal Links for launching the apps.

    You could refer to the following documentation for more details:

    1. Handling Android App Links.
    2. Support Universal Links.
    3. Enable apps for websites using app URI handlers.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.