Environment
| Technology |
Version |
| Flutter version |
3.13.2 |
| Plugin version |
6.0.0 |
| Android version |
11, MIUI 12.5.15/12.1.1 |
| iOS version |
n/a |
| macOS version |
n/a |
| Xcode version |
n/a |
| Google Chrome version |
n/a |
Device information: Xiaomi Redmi Note 8 Pro / Xiaomi Mi 9T
Description
Provided code worked fine before I moved from version 5.8.0 to version 6.0.0. After upgrade callHandler is not available from the website opened in InAppBrowser. I've been looking for a solution, but it seems that no one else have been affected by this.
Stoped working only on Android devices, I tested it on iOS 17.1.2 and it works just fine.
Expected behavior:
callHandler method should be injected into InAppBrowser
Current behavior:
callHandler is undefined when creating InAppBrowser
Steps to reproduce
final options = InAppBrowserClassSettings(
browserSettings: InAppBrowserSettings(
hideTitleBar: true,
allowGoBackWithBackButton: false,
shouldCloseOnBackButtonPressed: true,
hideToolbarTop: !displayNavigation,
hideUrlBar: true,
),
webViewSettings: InAppWebViewSettings(
useShouldOverrideUrlLoading: true,
javaScriptEnabled: true,
isInspectable: true,
clearCache: true,
clearSessionCache: true,
),
);
final InAppBrowser browser = CustomBrowser(
onCloseCallback: () {
// Do something
},
);
browser.openUrlRequest(
urlRequest: URLRequest(url: WebUri(url)),
settings: options,
);
class CustomBrowser extends InAppBrowser {
CustomBrowser({
this.onCloseCallback,
int? windowId,
UnmodifiableListView<UserScript>? initialUserScripts,
}) : super(
windowId: windowId,
initialUserScripts: initialUserScripts,
);
final Function()? onCloseCallback;
@override
Future onBrowserCreated() async {
developer.log("Browser Created!");
if (webViewController != null) {
developer.log('Adding JS handler');
webViewController!.addJavaScriptHandler(
handlerName: JavaScriptHandlerType.closeInAppBrowser,
callback: (_) {
if (onCloseCallback != null) {
onCloseCallback!();
}
close();
},
);
}
}
}
Images


Environment
Device information: Xiaomi Redmi Note 8 Pro / Xiaomi Mi 9T
Description
Provided code worked fine before I moved from version
5.8.0to version6.0.0. After upgradecallHandleris not available from the website opened inInAppBrowser. I've been looking for a solution, but it seems that no one else have been affected by this.Stoped working only on Android devices, I tested it on iOS 17.1.2 and it works just fine.
Expected behavior:
callHandlermethod should be injected intoInAppBrowserCurrent behavior:
callHandleris undefined when creatingInAppBrowserSteps to reproduce
Images