How to enable JavaScript in WebView?

How to enable JavaScript in WebView?
A . myWebView. setJavaScriptEnabled(true);
B . myWebView.getJavaScriptSettings.setEnabled(true)
C . myWebView.getSettings().setJavaScriptEnabled(true);
D . Java script is always enabled in WebView

Answer: C

Explanation:

JavaScript is disabled in a WebView by default. You can enable it through the WebSettings attached to your WebView. You can retrieve WebSettings with getSettings(), then enable JavaScript with setJavaScriptEnabled().

For example:

WebView myWebView = (WebView) findViewById(R.id.webview);

WebSettings webSettings = myWebView.getSettings();

webSettings.setJavaScriptEnabled(true);

References:

http://developer.android.com/guide/webapps/webview.html

Latest AND-401 Dumps Valid Version with 228 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments