重写WebViewClient方法
代码语言:javascript复制public class MyWebViewClient extends WebViewClient {
public boolean shouldOverrideUrlLoading(WebView webview, String url) {
webview.loadUrl(url);
return true;
}
public void onPageFinished(WebView view, String url) {
CookieManager cookieManager = CookieManager.getInstance();
String CookieStr = cookieManager.getCookie(url);
LogUtil.i("Cookies", "Cookies = " CookieStr);
super.onPageFinished(view, url);
}
}
调用
代码语言:javascript复制mWebView.setWebViewClient(new MyWebViewClient());