首页 > 系统 > Android > 正文

Android WebView添加Cookie和添加请求的头

2019-11-09 16:08:12
字体:
来源:转载
供稿:网友

在Android中使用WebView过程中,

1.如何添加Cookie,是通过webview专门的存储Cookie的工具类:CookieManager。

使用方法:

CookieManager.getInstance().setCookie(url, Cookie);
2.如何给url添加头,需要使用loadUrl(String url, Map<String, String> additionalHttpHeaders)这个方法。
使用方法:
Map<String,String> map=new HashMap<>();map.put("1",1);
webView.loadUrl(url,map);


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表