I have an Android app made using Flutter Webview. When the user click on an external link, I want the link to open in the browser. How can I do it?
In fact, it would be nice to open external links in a window like Instagram does. Is there a way to do this?
Edit:
website.com is my app's homepage. That is not a external link. What I want is when trying to open a link other than website.com, it opens in a browser or a window.
Home Page:
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
class Forum extends StatefulWidget {
@override
_ForumState createState() => _ForumState();
}
class _ForumState extends State<Forum> {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Forum',
home: Scaffold(
body: WebView(initialUrl: "https://website.com",
javascriptMode: JavascriptMode.unrestricted,
),
)
);
}
}