vendredi 20 février 2015

last modified date in javascipt

I am wondering how can I make a javascript function that will return the date and time the HTML/PHP file was last modified.


I found this on W3, but the button has to be clicked in order for the script to run.



<script>
function myFunction() {
var x = document.lastModified;
document.getElementById("demo").innerHTML = x;
}
</script>


Is there a way to get it to run when something is changed on the file. As I'm typing this I think it is a lot more difficult than I thought, and what I'm thinking of might not even be possible. But, I am not great with JS so I would like some input before just changing the last modified date for my site manually each time I update it.


Thanks!





Aucun commentaire:

Enregistrer un commentaire