You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
url starting with "www" are not launched anymore #51299
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.
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.
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
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.
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.
Activity
stuartmorgan-g commentedon Feb 24, 2020
What function/class/plugin is this in reference to? Could you provide some sample code to clarify what this is about specifically?
Those aren't URLs, they are host names.
www.google.frcould 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.deacon78 commentedon Feb 24, 2020
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
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'; } }stuartmorgan-g commentedon Feb 24, 2020
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_launcherisn'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."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.
github-actions commentedon Aug 22, 2021
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 -vand a minimal reproduction of the issue.