webview

 webView = (WebView) findViewById(R.id.webView);
    webView.loadUrl(url);
    //防止部分网站的JS不能用
    webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setDomStorageEnabled(true);
    //防止用第三方浏览器打开
    webView.setWebViewClient(new WebViewClient(){
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String newUrl) {
            Log.e("url11","ur222222="+ newUrl);
            view.loadUrl(newUrl);
            return true;
    }

    });

你可能感兴趣的:(webview)