Skip to content

[url_launcher_android] doesn't open intent hyperlinks from in-app webview (without Custom Tabs) #106331

Description

@MarcinusX

If you use url_launcher on Android to open either a https link or mailto link everything works find.
However, if you open an https link that will have a button opening a mailto link, it fails.

Steps to Reproduce

Only on Android

  1. Open the website using url_launcher, for example flutter.dev
  2. Scroll down to Press section in the footer and click it (it has mailto: hyperlink)

Expected results:
I expect a mailing app to be opened

Actual results:
An error page with error: ERR_UNKNOWN_URL_SCHEME

Code sample
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher_string.dart';

void main() {
  runApp(_MyApp());
}

class _MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: ElevatedButton(
            onPressed: () => launchUrlString('https://flutter.dev'),
            child: const Text('Open flutter.dev'),
          ),
        ),
      ),
    );
  }
}
Logs
[✓] Flutter (Channel stable, 3.0.2, on macOS 12.4 21F79 darwin-arm, locale en-PL)
    • Flutter version 3.0.2 at /Users/marcinszalek/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cd41fdd495 (13 days ago), 2022-06-08 09:52:13 -0700
    • Engine revision f15f824b57
    • Dart version 2.17.3
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/marcinszalek/Library/Android/sdk
    • Platform android-32, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.67.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.40.0

[✓] Connected device (3 available)
    • SM A528B (mobile) • R5CRA1FNLAX • android-arm64  • Android 12 (API 31)
    • macOS (desktop)   • macos       • darwin-arm64   • macOS 12.4 21F79 darwin-arm
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 102.0.5005.115

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

demo.mp4

Activity

  1. changed the title [-]url_launcher_android doesn't open intent hyperlinks from webview[/-] [+][url_launcher_android] doesn't open intent hyperlinks from webview[/+] on Jun 21, 2022
  2. added
    in triagePresently being triaged by the triage team
    on Jun 21, 2022
  3. exaby73 commented on Jun 21, 2022

    @exaby73
    Member

    I can reproduce this in stable and master, with url_launcher: 6.1.3.

    Screenshot image
    Code sample
    import 'package:flutter/material.dart';
    import 'package:url_launcher/url_launcher.dart';
    
    void main() {
      runApp(_MyApp());
    }
    
    class _MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: Scaffold(
            body: Center(
              child: ElevatedButton(
                onPressed: () => launchUrl(Uri.parse('https://flutter.dev')),
                child: const Text('Open flutter.dev'),
              ),
            ),
          ),
        );
      }
    }
    flutter doctor -v (Stable)
    [✓] Flutter (Channel stable, 3.0.2, on macOS 12.4 21F79 darwin-arm, locale en-US)
        • Flutter version 3.0.2 at /Users/nabeelparkar/fvm/versions/stable
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision cd41fdd495 (13 days ago), 2022-06-08 09:52:13 -0700
        • Engine revision f15f824b57
        • Dart version 2.17.3
        • DevTools version 2.12.2
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4)
        • Android SDK at /Users/nabeelparkar/Library/Android/sdk/
        • Platform android-33, build-tools 33.0.0-rc4
        • ANDROID_SDK_ROOT = /Users/nabeelparkar/Library/Android/sdk/
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • CHROME_EXECUTABLE = /Applications/Brave Browser.app/Contents/MacOS/Brave Browser
    
    [✓] Android Studio (version 2021.2)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2022.1.2)
        • IntelliJ at /Applications/IntelliJ IDEA.app
        • Flutter plugin version 68.1.4
        • Dart plugin version 221.5787.37
    
    [✓] VS Code (version 1.68.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.42.0
    
    [✓] Connected device (2 available)
        • macOS (desktop) • macos  • darwin-arm64   • macOS 12.4 21F79 darwin-arm
        • Chrome (web)    • chrome • web-javascript • Brave Browser 102.1.39.122
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
    flutter doctor -v (Master)
    [✓] Flutter (Channel master, 3.1.0-0.0.pre.1317, on macOS 12.4 21F79 darwin-arm, locale en-US)
        • Flutter version 3.1.0-0.0.pre.1317 on channel master at /Users/nabeelparkar/fvm/versions/master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision d4929bc828 (6 hours ago), 2022-06-20 20:09:05 -0400
        • Engine revision ceac23d7a9
        • Dart version 2.18.0 (build 2.18.0-190.0.dev)
        • DevTools version 2.14.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4)
        • Android SDK at /Users/nabeelparkar/Library/Android/sdk/
        • Platform android-33, build-tools 33.0.0-rc4
        • ANDROID_SDK_ROOT = /Users/nabeelparkar/Library/Android/sdk/
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 13F100
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • CHROME_EXECUTABLE = /Applications/Brave Browser.app/Contents/MacOS/Brave Browser
    
    [✓] Android Studio (version 2021.2)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2022.1.2)
        • IntelliJ at /Applications/IntelliJ IDEA.app
        • Flutter plugin version 68.1.4
        • Dart plugin version 221.5787.37
    
    [✓] VS Code (version 1.68.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.42.0
    
    [✓] Connected device (2 available)
        • macOS (desktop) • macos  • darwin-arm64   • macOS 12.4 21F79 darwin-arm
        • Chrome (web)    • chrome • web-javascript • Brave Browser 102.1.39.122
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
  4. added
    p: url_launcherPlugin to launch external applications
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    platform-androidAndroid applications specifically
    and removed
    in triagePresently being triaged by the triage team
    on Jun 21, 2022
  5. mrkim0425 commented on Jun 22, 2022

    @mrkim0425

    i had same problem too today and fixed it by changing LaunchMode

    code before
    스크린샷 2022-06-22 오후 8 19 57

    code after
    스크린샷 2022-06-22 오후 8 19 44

    only LaunchMode externalApplication worked for me

    hope this case fixes

  6. MarcinusX commented on Jun 23, 2022

    @MarcinusX
    ContributorAuthor

    It's not the same case. I don't want to launch mailto directly from urlLauncher. I want to launch a https link which will open a webview in which there will be clickable mailto link.

  7. added
    P2Important issues not at the top of the work list
    on Jun 23, 2022
  8. sawirricardo commented on Jul 4, 2022

    @sawirricardo
  9. 1 remaining item

  10. gnprice commented on Aug 17, 2023

    @gnprice
    Member

    One way to fix this issue would be for us to switch to opening URLs in a Chrome custom tab rather than our own webview screen:

    Specifically, I reproduced this issue, and then went and opened the same web page in a Chrome custom tab in a non-Flutter app. There, the same mailto: link successfully opened a mail client, ready to compose a message to the given recipient.

  11. changed the title [-][url_launcher_android] doesn't open intent hyperlinks from webview[/-] [+][url_launcher_android] doesn't open intent hyperlinks from in-app webview (without Custom Tabs)[/+] on Aug 31, 2023
  12. stuartmorgan-g commented on Aug 31, 2023

    @stuartmorgan-g
    Contributor

    Anyone affected by this issue can flutter pub upgrade to pick up url_launcher_android 6.1.0 or later, and in supported configurations in-app mode will use Custom Tabs instead of the previous webview, which won't have this issue.

  13. tirth-patel-nc commented on May 15, 2025

    @tirth-patel-nc
    Member

    Triage Report

    I was not able to reproduce the issue using the provided code sample on either the stable (3.29.3) or master (3.33.0-1.0.pre.83) channels.

    The "Press" hyperlink isn't available on the Flutter website, so I used a different site to reproduce the issue.

    url_launcher - 6.3.1

    Screen.Recording.2025-05-15.at.4.54.17.PM.mov
    Code Sample
    import 'package:flutter/material.dart';
    import 'package:url_launcher/url_launcher_string.dart';
    
    void main() {
      runApp(_MyApp());
    }
    
    class _MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: Scaffold(
            body: Center(
              child: ElevatedButton(
                onPressed:
                    () => launchUrlString(
                      'https://www.rapidtables.com/web/html/mailto.html',
                    ),
                child: const Text('Open'),
              ),
            ),
          ),
        );
      }
    }
    stable (3.29.3) - flutter doctor -v
    [✓] Flutter (Channel stable, 3.29.3, on macOS 15.4.1 24E263 darwin-arm64, locale
        en-IN) [970ms]
        • Flutter version 3.29.3 on channel stable at
          /Users/tirthpatel/Development/flutter_stable/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision ea121f8859 (4 weeks ago), 2025-04-11 19:10:07 +0000
        • Engine revision cf56914b32
        • Dart version 3.7.2
        • DevTools version 2.42.3
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
        [855ms]
        • Android SDK at /Users/tirthpatel/Library/Android/sdk
        • Platform android-36, build-tools 36.0.0
        • Java binary at: /Applications/Android
          Studio.app/Contents/jbr/Contents/Home/bin/java
          This is the JDK bundled with the latest Android Studio installation on
          this machine.
          To manually set the JDK path, use: `flutter config
          --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 16.3) [556ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 16E140
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [9ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2024.3) [9ms]
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42)
    
    [✓] VS Code (version 1.99.3) [8ms]
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension can be installed from:
          🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
    
    [✓] Connected device (3 available) [5.5s]
        • macOS (desktop)                 • macos                 • darwin-arm64   •
          macOS 15.4.1 24E263 darwin-arm64
        • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         •
          macOS 15.4.1 24E263 darwin-arm64
        • Chrome (web)                    • chrome                • web-javascript •
          Google Chrome 135.0.7049.115
    
    [✓] Network resources [559ms]
        • All expected network resources are available.
    
    • No issues found!
    
    master (3.33.0-1.0.pre.83) - flutter doctor -v
    [✓] Flutter (Channel master, 3.33.0-1.0.pre.83, on macOS 15.4.1 24E263 darwin-arm64, locale en-IN) [1,952ms]
        • Flutter version 3.33.0-1.0.pre.83 on channel master at /Users/tirthpatel/Development/flutter_master/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision eb0712fd4c (70 minutes ago), 2025-05-14 21:11:17 -0700
        • Engine revision eb0712fd4c
        • Dart version 3.9.0 (build 3.9.0-117.0.dev)
        • DevTools version 2.46.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [880ms]
        • Android SDK at /Users/tirthpatel/Library/Android/sdk
        • Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
        • Platform android-36, build-tools 36.0.0
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
          This is the JDK bundled with the latest Android Studio installation on this machine.
          To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 16.3) [620ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 16E140
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [8ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2024.3) [7ms]
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42)
    
    [✓] VS Code (version 1.100.0) [7ms]
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.110.0
    
    [✓] Connected device (2 available) [5.6s]
        • macOS (desktop) • macos  • darwin-arm64   • macOS 15.4.1 24E263 darwin-arm64
        • Chrome (web)    • chrome • web-javascript • Google Chrome 136.0.7103.94
    
    [✓] Network resources [864ms]
        • All expected network resources are available.
    
    • No issues found!
    

    I’ll go ahead and close this issue. Feel free to reopen it if you're still encountering problems or can provide additional reproduction steps.

  14. github-actions commented on May 29, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  15. locked as resolved and limited conversation to collaborators on May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: url_launcherPlugin to launch external applicationspackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions