Skip to content

How to disable user Text selection in flutter_inappwebview 6.0.0? #2027

Description

@sachinbhartiaphro

How to disable user Text selection in flutter_inappwebview 6.0.0 Plugin We are using This method but its working fine in Android and iOS its not working . Can you Please provide me with a better solution.

Plugin Version => flutter_inappwebview 6.0.0
iOS Tesing Device => iPhone7
Flutter Version => Flutter 3.16.3
Dart Version => Dart 3.2.3

code => onLoadStop: (controller, url) async {
// Inject JavaScript code to disable text selection for every page load
controller.evaluateJavascript(source: '''
document.body.style.userSelect = 'none';
document.body.style.webkitTouchCallout = 'none';
document.documentElement.style.touchAction = "pan-x pan-y";
''');

                        Utility.safePrint("On-Load-Stop-Url: $url");
                        setState(() {
                          this.url = url.toString();
                        });

                        // Additional logic after page load stops
                        pullToRefreshController?.endRefreshing();
                        webCookie = await controller.evaluateJavascript(
                            source: "document.cookie");
                        getInitialCartData();
                        setState(() {
                          loading = false;
                          displayLoader(false);
                        });
                      },

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstale

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions