title: Handling cookies in Android webview
body: <p>I wrote the following html file</p>
  
  <pre><code>&lt;code&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;script text ="text/javascript"&gt;
              function createCookie(name,value,days) {
                  if (days) {
                      var date = new Date();
                      date.setTime(date.getTime()+(days*24*60*60*1000));
                      var expires = "; expires="+date.toGMTString();
                  }
                  else var expires = "";
                  document.cookie = name+"="+value+expires+"; path=/";
              }
  
              function readCookie(name) {
                  var nameEQ = name + "=";
                  var ca = document.cookie.split(';');
                  for(var i=0;i &lt; ca.length;i++) {
                      var c = ca[i];
                      while (c.charAt(0)==' ') c = c.substring(1,c.length);
                      if (c.indexOf(nameEQ) == 0) return(c.substring(nameEQ.length,c.length));
                  }
                  return null;
              }
  
              function modifyCookie() {
                  var newsessid = document.getElementById('userid').value;
                  //var oldsessid = document.getElementById('userid').value;
                  if(newsessid != "") {
                          eraseCookie('session id') ;
                          createCookie('session id', newsessid, 1);
                          //alert(readCookie('session id'));
                          document.getElementById('cookies').innerHTML = readCookie('session id');
                          return true;
                  }
  
                  //.value = readCookie('session id');
              }
  
              function eraseCookie(name) {
                  createCookie(name,"",-1);
              }
  
              function fillTextBox() {
                  //alert("Running");
                  document.getElementById('cookies').innerHTML = readCookie('session id');
                  document.getElementById('userId').value = document.getElementById('sessid').value;
              }
          &lt;/script&gt;
      &lt;head&gt;
      &lt;body onload="fillTextBox()" style = "height : 480px; width : 320px; background-image : url('investmentbanking/background2.png'); background-repeat : no-repeat"&gt;
          &lt;div style = "position : absolute; left = 80px; top = 160px;"&gt;  
              &lt;label style = "color : #ffffff;"&gt;Session Id :&lt;/label&gt;
              &lt;input type="text" id="userid" name="session"/&gt;
              &lt;br/&gt;&lt;br/&gt;
              &lt;input type="hidden" id ="sessid" name="user" value="truce"/&gt;
              &lt;input type="button" onclick="modifyCookie()" value="Modify Cookie" /&gt;
              &lt;br/&gt;
              &lt;label&gt;Stored Cookies : &lt;label/&gt;&lt;label id = "cookies"/&gt;
          &lt;/div&gt;  
      &lt;/body&gt;
  &lt;/html&gt;
  &lt;/code&gt;
  </code></pre>
  
  <p>When i open this file with my webview in android, and modify the content of the text box, and hit the modify cookie button, the text beside the "Cookies" doesn't get changed. The code works properly on Firefox and IE in the desktop, but not here... what could be the problem???</p>