Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I use document.getElementsByClassName... #422

Closed
NTMS2017 opened this issue May 17, 2019 · 3 comments
Closed

How can I use document.getElementsByClassName... #422

NTMS2017 opened this issue May 17, 2019 · 3 comments

Comments

@NTMS2017
Copy link

I need to display part of the my web page. I can do it with Android WebView.
In Flutter How can I display a part of the webpage and use document.getElementsByClassName?

view.getSettings().setJavaScriptEnabled(true);
        view.setWebViewClient(new WebViewClient() {

            @Override
            public void onPageFinished(WebView view, String url)
            {
                view.loadUrl("javascript:(function() { " +
                        "var head = document.getElementsByClassName('header')[0].style.display='none'; " +
                        "var head = document.getElementsByClassName('blog-sidebar')[0].style.display='none'; " +
                        "var head = document.getElementsByClassName('footer-container')[0].style.display='none'; " +
                        "})()");

            }
        });
        view.loadUrl("your url");
@adammesa
Copy link

adammesa commented Jun 4, 2019

You can load custom javascript by using the evalJavascript(string) function after your page has loaded. Have you tried that?

@charafau
Copy link
Collaborator

Thanks @muffinjello once again... I think I need to add some docs for invoking custom javascript..

@TTutorials
Copy link

I tried this but not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants