Objective
- I am trying to copy a text from a copy button inside a web page. The copy function itself is working fine when i open it using chrome, firefox and safari browser
Expected behavior: After pressing the copy button, the text is copied into phone clipboard. Current behavior: After pressing the copy button, Flutter InAppWebView throwing error Uncaught (in promise) NotAllowedError: Write permission denied.
Step done to fix this error
- I have added android permission inside my Project > android > app > src > main >AndroidManifest.xml
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
- PermissionRequestResponseAction is set to .GRANT, however, this callback is not called when i press on the copy button inside the web page
androidOnPermissionRequest: (webViewController, origin, resources) async {
return PermissionRequestResponse(
resources: resources,
action: PermissionRequestResponseAction.GRANT,
);
},
- javaScriptEnabled is set to true for Android, and its true by default
InAppWebViewGroupOptions options = InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
// allowFileAccessFromFileURLs: true,
// javaScriptCanOpenWindowsAutomatically: true,
// allowUniversalAccessFromFileURLs: true,
javaScriptEnabled: true,
useShouldOverrideUrlLoading: true,
mediaPlaybackRequiresUserGesture: false),
android: AndroidInAppWebViewOptions(
useHybridComposition: true,
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
));
Here are some related issue that have been asked, but still no solution for it:
webview_flutter: Uncaught (in promise) NotAllowedError: Write permission denied
https://github.com/pichillilorenzo/flutter_inappwebview/issues/678
How to solve for this error? Any help is much appreciated, thank you