-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] shouldOverrideUrlLoading not working #1350
Comments
👋 @jypDev 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 Following these steps can save you, me, and other people a lot of time, thanks! |
I also had same problem! @pichillilorenzo
|
same |
If you need to launch url with custom procotol/scheme that isn’t “http” or “https”, such as “intent”, “whatsapp” and others, you should implement it by your self, for example using the “url_launcher” plugin! Android and iOS are different platform, so they may behave differently. You can check the InAppWebView code example of the repository. |
Ok, so, please, could give me an example code to test and the steps to reproduce the issue? Thanks! Also, which version of the plugin are you using? |
In my case useShouldOverrideUrlLoading is not firing on Android at all, while NavigateDelegate from web_view_flutter is. |
I will try The latest stable |
Without a code example, I can’t help you in any way! From my tests, it is working as expected |
Is it correct? It is only necessary to provide shouldOverrideUrlLoading function to handle navigation on every page? Are there any conditions for it not being triggered? |
It appeared that I was not passing useShouldOverrideUrlLoading = true into InAppWebViewOptions Everything is working fine, thanks for replying @pichillilorenzo |
No problem! 👌👍 |
@Woojin-Crive as you may have read in the code comment, there isn't any way to load an URL for a frame that is not the main frame on Android, so if the request is not for the main frame, the navigation is allowed. |
@pichillilorenzo |
However, I'm trying to understand how to not break dart Uri parsing with such kind of Uri coming from the Android native side. |
Released new version For more details on how |
I able to call this method by setting this option in flutter_inappwebview. var option = InAppWebViewOptions(); |
Using WebUri enables the developer to handle the exception of the dart uri parser! |
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 and a minimal reproduction of the issue. |
Result value of requst.isForMainFrame() in shouldOverrideUrlLoading function
It returns false in chrome version 99 and above, so it can't handle intent links correctly.
I also handled NavigationActionPolicy.CANCEL in flutter
Environment
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.5 21G72 darwin-arm, locale ko-KR)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
[✓] VS Code (version 1.70.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
Plugin version - 5.4.4+3
The text was updated successfully, but these errors were encountered: