flutter inAppWebview: reacting to click on pdf link


I’m trying to use InAppWebview plugin in flutter, works well but when I click on a pdf link it does nothing.

to try that just click on the first or second link in the google search.

nor shouldOverrideUrlLoading or onDownloadStart

any idea on how to show or how to intercept it?

    class WebViewWidget extends StatefulWidget {
      final String url;
      _WebViewWidgetState createState() => _WebViewWidgetState();
    class _WebViewWidgetState extends State<WebViewWidget> {
      final Completer<InAppWebViewController> _controller =
      final InAppWebViewGroupOptions _options = InAppWebViewGroupOptions(
        crossPlatform: InAppWebViewOptions(
          useShouldOverrideUrlLoading: true,
          mediaPlaybackRequiresUserGesture: false,
          javaScriptEnabled: true,
        android: AndroidInAppWebViewOptions(
          useHybridComposition: true,
          loadWithOverviewMode: true,
          useWideViewPort: false,
          builtInZoomControls: false,
          domStorageEnabled: true,
          supportMultipleWindows: true,
      Widget build(BuildContext context) {
        return Scaffold(
          body: Builder(builder: (BuildContext context) {
            return InAppWebView(
                initialUrlRequest: URLRequest(url: Uri.parse("https://www.google.com/search?client=firefox-b-d&q=pdf+example")),
                initialOptions: _options,
                shouldOverrideUrlLoading: (controller, action) {
                  return Future.value(NavigationActionPolicy.ALLOW);
                onWebViewCreated: (webViewController) {
                onDownloadStart: (controller, uri) {


To onDownloadStart to be called useOnDownloadStart: true must be set on crossPlatform: InAppWebViewOptions(). Once that was done the callback was called correctly.

Answered By – jack_the_beast

Answer Checked By – Timothy Miller (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *