Jump to content
kimber

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

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...