Как сказал дуирлай, посмотрите на Найдите размер файла за ссылкой для скачивания с помощью jQuery .
Тогда способ обновления заголовка с помощью jQuery будет таким ...
$(function() {
$("a[href$='.pdf']").each(function(i, obj) {
var link = $(obj);
$.ajax({
type: "HEAD",
url: link.attr("href"),
success: function() {
var length = request.getResponseHeader("Content-Length");
if (!isNaN(parseInt(length))) {
var fileSize = readablizeBytes(length);
link.attr("title", "PDF, "+ fileSize +", opens in a new window");
}
}
})
})
});
// From http://web.elctech.com/2009/01/06/convert-filesize-bytes-to-readable-string-in-javascript/
function readablizeBytes(bytes) {
var s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB'];
var e = Math.floor(Math.log(bytes)/Math.log(1024));
return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+" "+s[e];
}