1

I'm currently building an Android App that uses a Webview to show a HTML site that has a javascript script in it. I use the following code:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.e(TAG, "-----> Starting HowItWorksActivity");
    setContentView(R.layout.activity_how_it_works);
    WebView howItWorksView = (WebView) findViewById(R.id.howItWorksView);
    WebSettings settings = howItWorksView.getSettings();
    settings.setDefaultTextEncodingName("utf-8");
    settings.setJavaScriptEnabled(true);
    settings.setDomStorageEnabled(true);

    howItWorksView.loadUrl("http://some_url/faq_de.html");
}

Where the html page looks like the following:

<html lang="de">
<head>
</head>
 (...)
 <h1>Some Text </h1>
 <script src="getmoretext.js" type="text/javascript"></script>
 (...)
</body>

In the Browser, this works perfectly fine, however the webview doesn't show the part that is created by the getmoretext script....

I have JavaScript and DomStorage enabled in the webview.

Any ideas?

1
  • PS: you don't need type="text/javascript". Commented Jun 18, 2016 at 9:30

1 Answer 1

1

You have to add this line of code:

howItWorksView.setWebChromeClient(new WebChromeClient())
Sign up to request clarification or add additional context in comments.

1 Comment

Still don't work

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.