Forum Xamarin.Forms

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Is it possible to open html file with external browser?

PsychoZeyarPsychoZeyar Member ✭✭✭

I want to open html file in external browser from my app.
Is it possible? How can I do?

Best Answers

  • scdqg5695scdqg5695 Member ✭✭
    Accepted Answer

    On Android, you can place the file into shared folder and use the following code to load the html.

    Intent intent = new Intent(Intent.ActionView);
    intent.SetDataAndType(uri, "text/html");
    intent.SetFlags(ActivityFlags.NewTask);
    StartActivity(intent);
    
  • ColeXColeX Member, Xamarin Team Xamurai
    edited February 8 Accepted Answer

    Android

    1. Place the html file in shared folder .
    2. Get the file and open it as @scdgg5695 mentioned or use Xamarin.Essentials: Browser .

    iOS

    It is not supported to open html file with external browser .


    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

Answers

  • scdqg5695scdqg5695 Member ✭✭
    Accepted Answer

    On Android, you can place the file into shared folder and use the following code to load the html.

    Intent intent = new Intent(Intent.ActionView);
    intent.SetDataAndType(uri, "text/html");
    intent.SetFlags(ActivityFlags.NewTask);
    StartActivity(intent);
    
  • ColeXColeX Member, Xamarin Team Xamurai
    edited February 8 Accepted Answer

    Android

    1. Place the html file in shared folder .
    2. Get the file and open it as @scdgg5695 mentioned or use Xamarin.Essentials: Browser .

    iOS

    It is not supported to open html file with external browser .


    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

Sign In or Register to comment.