Detect *target* file size using JavaScript
Posted
by noblethrasher
on Stack Overflow
See other posts from Stack Overflow
or by noblethrasher
Published on 2010-05-18T19:07:44Z
Indexed on
2010/05/18
19:10 UTC
Read the original article
Hit count: 204
Hi,
Would like to write a script to detect the file size of the target of a link on a web page.
Right now I have a function that finds all links to PDF files (i.e. the href ends with '.pdf') and appends the string '[pdf]' to the innerText. I would like to extend it so that I can also append some text advising the user that the target is a large file (e.g. greater than 1MB).
Thanks
© Stack Overflow or respective owner