Using javascript is an expensive way to do this- and it only works for files on the same domain as the page with the links.
Much better to write a script on the server that will rewrite the html page
when you modify one of its linked files.
This script will add the modified date of a link to its title the first time you hover or focus it-
You can modify it to write all the modified dates into the link text in the onload handler,
but this really belongs in a server routine.
-
-
function titleModified(who){
-
var aj= AJX(); // http request object, defined below (or use your own)
-
var url, t;
-
who= window.event? event.srcElement: who.target;
-
url= who.href;
-
t= who.title || '';
-
try {
-
aj.open("HEAD", url, false);
-
aj.send(null);
-
if (aj.status== 200) tem= aj.getResponseHeader('Last-Modified');
-
else tem= '';
-
}
-
catch (er) {
-
tem= '';
-
}
-
if(tem) who.title= t+' Last modified:'+tem;
-
who.onmouseover= ''; // don't call again for this element
-
who.onfocus= '';
-
}
-
-
function AJX(){
-
var obj;
-
if (window.XMLHttpRequest) return new XMLHttpRequest();
-
else if (window.ActiveXObject){
-
try{
-
obj= new ActiveXObject('MSXML2.XMLHTTP.3.0');
-
}
-
catch(er){
-
try{
-
obj= new ActiveXObject("Microsoft.XMLHTTP");
-
}
-
catch(er){
-
obj= false;
-
}
-
}
-
}
-
return obj;
-
}
-
-
-
window.onload= function(){
-
if(!AJX()) return false;
-
var cnt= 0, who,tem, A= document.getElementsByTagName('a');
-
while(A[cnt]){
-
who= A[cnt];
-
tem= who.href;
-
//next line to skip page bookmarks
-
if(tem && !/^#/.test(tem) && tem.indexOf(location.pathname)== -1){
-
who.onmouseover= titleModified;
-
who.onfocus= titleModified;
-
}
-
++cnt;
-
}
-
}