Jump to content

Can I attach var x = document.lastModified to a link?


kimber
 Share

Recommended Posts

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

Can I attach this javascript to a html download link so it shows the last time the link (file) was updated?  The links are like this:

<a href="http://url.com">News.mp3</a>

Link is: News.mp3
Last Updated:Fri Jun 14, 2020 05:20:13 pm

Ever time the audio file is replaces it shows the last updated.

I assume I can't but I'm getting desperate and figured I'd ask.

Thank you
Kim

Link to comment
Share on other sites

document.lastModified can only show information about the current page.

As I mentioned in another topic, you can use PHP's filemtime() function to get the modified date of a file on the server.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...