flutter_webview_plugin
flutter_webview_plugin copied to clipboard
User Agent in ipad not detected
WebviewScaffold( primary: false, resizeToAvoidBottomInset: !Platform.isIOS, userAgent: "SomeRandomUserAgent", url: "$someUrl", appBar: ab, initialChild: Container(), withLocalStorage: true, withJavascript: true, );
We have tested this in iphone ipad android simulators and devices and it works on iphone and android
but not in ipad.
what appears - in ipad - according to our logs is
"Mozilla/5.9 (Mackintosh; Intel Mac OS X 10_15_4) AppleWebKit/605/1/15 (KHTML, like Gecko)"
Otherwise it "SomeRandomUserAgent"
There is a fix described here:
In your project folder, edit the ./ios/.symlinks/plugins/flutter_webview_plugin/ios/Classes/FlutterWebviewPlugin.m file and after line 144 insert the following:
if (@available(iOS 9.0, *)) {
if (userAgent != (id)[NSNull null]) {
self.webview.customUserAgent = userAgent;
}
}
Then do a flutter clean/pub get and it should resolve the issue.