How to run custom Javascript using webview_flutter package?


I have build an app using webview_flutter plugin, now I want to hide a div from my webview.
The issue is I’m not able to figure out how to run custom Javascript using this webview_flutter.
I have read articles on stackoverflow for flutter_webview_plugin but not for this one.


Running custom JS

It is really simple to do so using the webview_flutter plugin.
You can simply use the controller object as,

_your_webview_controller.evaluateJavascript("<Some JS code>");

Hiding the div

              "document.getElementsByClassName('openAppButton')[0].style.display = 'none'");

Answered By – Apoorv pandey

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *