var scr=document.getElementsByTagName('script');
var src=scr[scr.length-1].getAttribute("src");
alert(src);
It seems that this solution might fail if the last script tag pulls an external JS file - like when the last script is a reference to Google Analytics (ga.js).
Leave a comment: