SmilingPolitely wrote:
<a href="filename>Click here to download file: size <script to insert
file size>, last modified on <script to insert date last modified></a>
Is this possible using only javascript. I don't have access to
PHP/ASP/anything else useful on the server. Perhaps you might know of
an alternate way to achieve my aims?
It is certainly possible using JavaScript on the server. If you do not
have server-side scripting available then if you consider those infos
important for your users you have to insert them by hand in the markup.
If the infos are optional you could consider using client-side script to
make HTTP HEAD requests and try to read out the info from the HTTP
response headers:
<http://home.arcor.de/martin.honnen/javascript/200504/test2005041101.html>
Note that the example is meant to be a proof of concept, I have tested
that it works with Mozilla and with IE on Windows but I know that at
least current beta releases of Opera have some support for
XMLHttpRequest but do not support methods to get the response headers.
And I think others have reported that some Safari versions do not
support HTTP HEAD requests.
So the code in the example would need to be improved to prevent or to at
least handle errors occuring in those browsers.
--
Martin Honnen
http://JavaScript.FAQTs.com/