How to insert "page last updated on <?>)" without typing it myself?
I was wondering if there was an automatic update withing MS Word webpage files that would automatically enter the current date on my template when I upload a new page?
2 Answers
- Anonymous1 decade agoFavorite Answer
Unfortunately, the previous answer doesn't achieve what you are after. The time that will be reported as the time last modified is the first time YOU visit the page, not the last time you edited the page on the server.
That's because JavaScript only has access to the local filesystem, not the server's filesystem.
You can see this for yourself here:
http://www.w3schools.com/js/tryit.asp?filename=try...
You can do what you want with a simple server-side include; link to explanation is below.
Most servers support server-side includes. Some require you to change your file extensions from .htm or .html to .shtm or .shtml, but most support SSI without modifying your file extensions.
- Anonymous1 decade ago
you can easily do this with javascript
<script type="text/javascript">
var updated = document.lastModified;
document.write ("This page was last updated " + updated );
</script>
edit after the below response:
The javascript lastModified method retrieves the last modified date from the http header, it doesn't have anything to do with local or server file system
The reason that on the w3schools site it has a last modified date as today is because maybe that frame's document has write permissions to it, so anyone trying that editor today will affect the date