Javascript is a scripting language that operates by the Document Object Model. You can think of it as the "infrastructure" of a web page. A couple of useful properties are document.lastModified which contains the date when the file was last modified/edited and document.fileSize which contains the size of the file in bytes.

I have made a small function to display this with the click of a button. I hope it is useful to some of you.

javascript:alert('File size: '+Math.round(document.fileSize/1024)+' kb\nLast modified: '+document.lastModified);

The output should be something like:

File size: 8 kb
Last modified: 04/28/2004 21:01:46

Note: the property document.fileSize is not in any specifications but the brainchild of some Microsoft developer. Therefore it is only supported by Microsoft's Internet Explorer, other browsers will return the value "NaN" (meaning Not a Number). Just use javascript:alert(document.lastModified);

This function can be bookmarked like any other URL. Go ahead, test it out by entering it on your address bar.

Log in or register to write something here or to contact authors.