flutter_inappwebview
flutter_inappwebview copied to clipboard
ERR_UNKNOWN_URL_SCHEME error inside WebView when accessing App in Play Store
- [x] I have read the Getting Started section
- [x] I have already searched for the same problem
Environment
| Technology | Version |
|---|---|
| Flutter version | 3.10.6 |
| Plugin version | 5.7.2 |
| Android version | 11 |
| iOS version | |
| macOS version | |
| Xcode version |
Device information:
Description
It successfully launches Play Store page. But when I clicked App Icon under 'More by xxxx', it returns "Webpage not available" net:: ERR_UNKNOWN_URL_SCHEME. Expected behavior: To display App page in Play Store Current behavior: It doesn't show the App page in Play Store
Steps to reproduce
- Click "More Apps" from my app
- It load my developer's page that shows all the apps
- Click on any app icon under "More by xxx", it returns an error.
👋 @jdevp
NOTE: This comment is auto-generated.
Are you sure you have already searched for the same problem?
Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!
If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.
In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.
Following these steps can save you, me, and other people a lot of time, thanks!
Thanks for you quick reponse. I did do some research before I opened the ticket. I think that it has something to do with new version of Flutter. My current app on Play Store works fine. It's just my upgraded version has this problem, even I use the same version for the plugin. The only thing changed is the Flutter version. For now, I'll just modify my code not to use the plugin when I need to show more apps from Play Store. Thanks! On Monday, August 14, 2023 at 01:07:34 AM EDT, github-actions[bot] @.***> wrote:
👋 @jdevp
NOTE: This comment is auto-generated.
Are you sure you have already searched for the same problem?
Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!
If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.
In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.
Following these steps can save you, me, and other people a lot of time, thanks!
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
SOLUTION You also need to specify on create window some of this link are opened in new tab
InAppWebView(
onCreateWindow: _onCreateWindow,
shouldOverrideUrlLoading: _shouldOverrideUrlLoading
}
Future<bool> _launchURL(String uri) async {
return await launchUrlString(
uri,
mode: LaunchMode.platformDefault,
);
}
Future<NavigationActionPolicy> _shouldOverrideUrlLoading(
InAppWebViewController controller,
NavigationAction shouldOverrideUrlLoadingRequest) async {
var uri = shouldOverrideUrlLoadingRequest.request.url;
if (uri == null) {
// controller.goBack();
return NavigationActionPolicy.CANCEL;
}
final uriString = uri.toString();
if (uriString.startsWith('http://') || uriString.startsWith('https://')) {
return NavigationActionPolicy.ALLOW;
} else {
// controller.goBack();
_launchURL(uriString);
return NavigationActionPolicy.CANCEL;
}
}
Future<bool> _onCreateWindow(
InAppWebViewController controller, CreateWindowAction action) async {
var uri = action.request.url;
if (uri == null) {
// controller.goBack();
return false;
}
final uriString = uri.toString();
if (uriString.startsWith('http://') || uriString.startsWith('https://')) {
return true;
} else {
// controller.goBack();
_launchURL(uriString);
return false;
}
}
@michaelpiper can you also look into this: link and let me know how can I achieve it. If you could help me implement it that would be great.