I wrote a small web based tool, which uses a file input to read a constantly changing file. The user selects it manually (once!) and JavaScript tracks when it was changed (last file modification time and file size). If it has changed, it reads the file contents again.
This works fine in all browsers on Windows. But on macOS (tested in Safari 10.1.2 and Firefox 51.0.1) only the last modification time seems to be updated. The file size is not updated and it seems, that the file contents cannot be read anymore too. So I can not track file changes in browsers on macOS.
But why? Is this a security limitation in macOS?
Please test with following snippet. Select a file (for example a text file), see last modified timestamp and file size, then change file and look again, if size has changed. On macOS the file size doesn't change.
No jQuery please.
window.addEventListener('load', function() {
window.setInterval(function() {
var logFile = document.querySelector('#file').files[0];
if (logFile) {
document.querySelector('#info').innerHTML = '<br/>' +
(new Date()).toString() + '<br/>Last modified: ' +
logFile.lastModified +
'<br/>Size: ' +
logFile.size;
}
}, 1000);
});
#info {
font-family: Courier;
font-size: 0.9em;
}
<!DOCTYPE html>
<input type="file" id="file" />
<p id="info"></p>