Skip to content

url starting with "www" are not launched anymore #51299

Closed

Description

@deacon78

Hello

I have notice that urls must start with "http" otherwise they are not launched.
This is the case with "www.google.fr" or "www.youtube.com" for example.

Thanks for update

Activity

  1. stuartmorgan-g commented on Feb 24, 2020

    @stuartmorgan-g
    Contributor

    What function/class/plugin is this in reference to? Could you provide some sample code to clarify what this is about specifically?

    This is the case with "www.google.fr" or "www.youtube.com" for example.

    Those aren't URLs, they are host names. www.google.fr could be be part of many, many URLs. Without a scheme, it is not a URL. Anything that says it requires a URL string as an argument that has previously accepted a bare host name would have guessing a scheme to try to construct a valid URL.

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 24, 2020
  3. deacon78 commented on Feb 24, 2020

    @deacon78
    Author

    Hello stuartmorgan
    I know but if you put those host names in google chrome, the navigator can reach the url of the web site.
    For a non web expert, that can be surprising.
    I print an alert message saying the url is invalid and must begin with http.
    The package is https://pub.dev/packages/url_launcher

    url_launcher: ^5.4.2

    Here is the function which throw the error :

    Future _launchURL(String url) async { if (await canLaunch(url)) { await launch(url); } else { throw 'Could not launch $url'; } }

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 24, 2020
  5. stuartmorgan-g commented on Feb 24, 2020

    @stuartmorgan-g
    Contributor

    I know but if you put those host names in google chrome, the navigator can reach the url of the web site.

    Because a browser is intended for browsing the web, so it can guess that the scheme is http(s) and be right essentially every time. url_launcher isn't a browser, it's a way of launching arbitrary URLs, registered by arbitrary applications--as the documentation for the plugin says, "The supported URL schemes depend on the underlying platform and installed apps."

    I print an alert message saying the url is invalid and must begin with http.

    If, in your specific use case, you believe that http is the scheme the user intends, then you can feel free to add it yourself before calling the plugin.

    Closing as this is working as intended. You need to provide it a valid URL.

  6. github-actions commented on Aug 22, 2021

    @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.

  7. locked as resolved and limited conversation to collaborators on Aug 22, 2021
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

    p: url_launcherPlugin to launch external applicationspackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions