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.
Asked
Active
Viewed 568 times
1 Answers
0
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
_controller.evaluateJavascript(
"document.getElementsByClassName('openAppButton')[0].style.display = 'none'");

Apoorv pandey
- 509
- 8
- 21
-
Answer is true but you should use `runJavascript` instead of `evaluateJavascript`since it's depracated. – Kayahan Kahrıman Feb 18 '22 at 13:14