hamburger
hamburger

Reputation: 1435

How to enable javascript in HTML for WebView?

I have a normal HTML/Javascript site witch is working in all browser perfectly. I registered now that, if someone is visiting my site via android-webview, javascript is disabled by default. On my page I have a pricelist witch will be open by adding a class with javascript. Thats means if my site is visited with webview the pricelist is not shown. Is there any solution to enable javascript in this case? I found something like this:

<WebView javaScriptEnabled={true}/>

or:

webSettings.setJavaScriptEnabled(true);

or:

webView.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl);

But I dont have any glue is this right and were to place it it my code.

And: Is there something like is webview in window

Upvotes: 1

Views: 1671

Answers (2)

Ajin kumar
Ajin kumar

Reputation: 311

this coding working well

webView=(WebView)findViewById(R.id.webView);
webView.setWebViewClient(new MyBrowser());
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
webView.loadUrl(url);

Upvotes: 1

pgarzina
pgarzina

Reputation: 61

Well if understood correctly, the person who made the android app, thus the implementation of an android-webview, should enable javascript so that your site can be viewed correctly.

Upvotes: 0

Related Questions