您正在下載CSV文件的瀏覽器和服務器應爲您協商緩存;我可能會誤解,但我不確定Papa Parse會怎麼做。
對於最後修改日期,如果文件恰好通過頁面上的<input type="file">
元素的用戶選擇,您可以訪問該文件對象,並檢查其lastModified
或lastModifiedDate
特性(至少,他們在Chrome存在)。
獲取文件的最後修改日期被下載,MDN has an example都爲你準備好:
function getHeaderTime() {
alert(this.getResponseHeader("Last-Modified")); /* A valid GMTString date or null */
}
var oReq = new XMLHttpRequest();
oReq.open("HEAD" /* use HEAD if you only need the headers! */, "yourpage.html", true);
oReq.onload = getHeaderTime;
oReq.send();
這只是做一個HEAD請求(只檢查上次修改,並沒有得到整個文件,所有你需要的是頭文件)並讀取Last-Modified頭文件。
我對一個稍微不同的問題的回答可能會有所幫助。 http://stackoverflow.com/a/9691669/212940 – vascowhite 2014-11-23 06:09:51