With the code below I'm able to read, and log to the console, the contents of a file (myfile.txt) hosted on-line on the same folder/server as the HTML page with such code.
<!DOCTYPE html>
<html>
<script>
async function doIt()
{
let response = await fetch("myfile.txt", {cache: "no-store"});
let contents = await response.text();
console.log(contents);
}
doIt();
</script>
</body>
</html>
My problem is that instead of the file contents I want to log the date/time when such file (myfile.txt) was last modified and I can't find the way to do it.
What am I missing? Would it be possible? How?
Many thanks in advance for any help!