i have following code display webpage in webview:
webview mywebview = (webview) findviewbyid(r.id.webview1); mywebview.loadurl("http://the.url.com"); websettings websettings = mywebview.getsettings(); websettings.setjavascriptenabled(true);
now want read cookie of webview. possible?
it quite late , might someone
you can cookie value this
public string getcookie(string sitename,string cookiename){ string cookievalue = null; cookiemanager cookiemanager = cookiemanager.getinstance(); string cookies = cookiemanager.getcookie(sitename); if(cookies != null){ string[] temp=cookies.split(";"); (string ar1 : temp ){ if(ar1.contains(cookiename)){ string[] temp1=ar1.split("="); cookievalue = temp1[1]; } } } return cookievalue; }
edit
point notice:
if loading url http://sitedomain.com
(without www
), sitename
www
not work method.
Comments
Post a Comment