Flutter Webview Hide All but One Div/Class

Viewed 361

I'm using Flutter Webview (webview_flutter: ^2.1.1) to display only one div of my website. All the information I could find was how to hide specific div/elements with the following codes, and they work.

onPageStarted: (url) {
_controller.evaluateJavascript(
    "document.getElementsByClassName('footer')[0].style.display='none';"
    "document.getElementById('more-info').style.display='none';"
    );
},

But when I do it this way, it becomes a long list of things that I need to hide from flutter webview so only the element I want is left. Is there not a way to just say I want to display the 'main_content' div, and hide all other divs/elements?

0 Answers
Related