WebView添加手动拼接Cookie
来源:互联网 发布:js 动态 array的方法 编辑:程序博客网 时间:2024/06/16 14:45
同样使用CookieManager
/** * 同步一下cookie */ public static void synCookies(Context context, String url) { CookieSyncManager.createInstance(context); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptCookie(true); cookieManager.removeAllCookie();//移除 /**cookie*/ String expires = new Date(System.currentTimeMillis() + 86400000).toGMTString(); String host = Uri.parse(url).getHost().replace("www", ""); String uidCookie = "uid=\""+GlobalVariable.getCurrentUserID()+"\";$Domain=\"" + host + "\";$Path=\"" + NetConst.URL_COMPANY_FLOWERCHART_COOKIE_PATH + "\";Max-Age=\"86400\";expires=\""+expires;//+"\";Secure;"; String cidCookie = "cid=\""+GlobalVariable.getCurrentSelectedCompanyID()+"\";$Domain=\"" + host + "\";$Path=\"" + NetConst.URL_COMPANY_FLOWERCHART_COOKIE_PATH + "\";Max-Age=\"86400\";expires=\""+expires;//+"\";Secure;"; /**cookie*/ cookieManager.setCookie(url,uidCookie); cookieManager.setCookie(url,cidCookie); CookieSyncManager.getInstance().sync(); }
0 0
- WebView添加手动拼接Cookie
- 给WebView添加Cookie
- webview添加cookie有时失效
- webview添加cookie有时失效
- NT_iOS笔记—webview添加Cookie
- Android WebView添加Cookie和添加请求的头
- json手动拼接
- WebView中给url添加cookie的值
- webView地址拼接
- 手动字符串拼接成JSON
- js手动存储cookie
- 清除WebView的Cookie
- android webview 保存cookie
- 储存webview 的 cookie
- WebView Cookie 通信
- 清除webview cookie
- iOS 设置webView cookie
- Passing cookie to webview
- Android-Universal-Image-Loader详解
- 工厂 模式
- hdu2072不同单词数(STL之set函数与stream流)
- Android图片上传工具类
- TableView 隐藏分割线
- WebView添加手动拼接Cookie
- HDU---1023-Train Problem II (Catalan数)
- Struts2获得HttpServletRequest / HttpSession / ServletContext / HttpServletResponse对象
- 线段树题型整理
- maven的setting.xml 配置文件详解
- OMNeT++ 代码迁移指南:从 3.x 到 4.0
- [dp]poj2385 AppleCatching
- 移动机器人平台的坐标系 (map,odom,base_link)
- 广播