Enable java script in WebView - Android User Interface

Android examples for User Interface:WebView Javascript

Description

Enable java script in WebView

Demo Code


//package com.java2s;
import android.annotation.SuppressLint;

import android.webkit.WebView;

public class Main {
    /**//  ww  w  .j av  a  2 s  .c o m
     * Enable java script.
     *
     * @param webView
     *     the web view
     * @param enabled
     *     the enabled
     */
    @SuppressLint("SetJavaScriptEnabled")
    public static void enableJavaScript(WebView webView, boolean enabled) {
        if (webView != null) {
            webView.getSettings().setJavaScriptEnabled(enabled);
        }
    }
}

Related Tutorials