title: Get Last-Modified date of a file using JS XMLHttpRequest() on IOS
body: <p>Here is my problem.</p>
  
  <p>I'm developing an webapp, written in Angular and NOT jQuery, for a client that need to have its database refreshed every week with new sets of data. So they chose to use SQLite3 because they can drop the new DB into a folder and the sales rep can download this DB file every Monday. But there are a series of data that gets cached on localStorage and those data need to be refreshed as soon as the iPad checks the DB file and returns true if is a new file. So, I'm using XMLHttpRequest() to check the head for the "Last-Modified" date and it works perfect on Chrome and Safari, but once I build the app and move to iPad, the Last-Modified date return null. I searched everywhere in the web to try find what could be wrong, but I just could not find any satisfactory answer:</p>
  
  <p>The code I'm using is </p>
  
  <pre><code>    var dbPath = "db/myDb.sqlite";
      var getMTime = function(url, callback) {
        var xhr = new XMLHttpRequest();
        xhr.open('HEAD', dbPath, true); 
        xhr.onreadystatechange = function() {
          if (xhr.readyState === 4 &amp;&amp; xhr.status === 200) {
            var mtime = new Date(xhr.getResponseHeader('Last-Modified'));
            if (mtime.toString() === 'Invalid Date') {
              callback(); // dont want to return a bad date
            } else {
              callback(mtime);
            }
          }
        }
        xhr.send();
      };
  </code></pre>
  
  <p>Thanks in advance for the help</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Looks like the IOS WebView wipes the HEAD object response... So, thats why by running <code>xhr.getResponseHeader</code> I get empty object, but I would love to know if there is an alternative for that and why this object is being wiped...</p>