Get Webpage File Date and File Size
By Stephen Bucaro
The document object has several properties that can provide you with
information about a webpage's file. The document object's fileCreatedDate,
fileModifiedDate, and fileSize properties can be used to determine the
date a webpage was created, the date it was last modified, and the size of the webpage
file. The example below shows how you could display these properties.
<html>
<head>
<script language="JavaScript">
function getSizeDates()
{
document.writeln("Created: " + document.fileCreatedDate);
document.writeln("Modified: " + document.fileModifiedDate);
document.writeln("Size: " + document.fileSize + " bytes");
}
</script>
</head>
<body onload="getSizeDates()">
</body>
</html>
• These methods receive their information from the operating system
file manager, so you must understand how the operating system deals with files to understand
the information provided by these methods. For example, if you move a file, it keeps the same
fileCreatedDate. If you make a copy of the file, the fileCreatedDate of the
copy will be the date you created the copy. Renaming a file does not change the
fileCreatedDate, but the fileModifiedDate will be the date that you
renamed the file.
More Java Script Code: • The Location Object • Java Script Quick Reference : JavaScript toString Method Converts a Number to a String • Interactively Set Webpage Colors • Extract Part of a String • A Brief History of JavaScript • The Browsers History Object • The Screen Object • The Document Object Model (DOM) • How to Use a JavaScript try-catch Block to Debug • Java Script confirm Message Box
|