No, this would allow to retrieve the contents of any URL, which would break some security policies. (This would be an equivalent of an ajax get request without same-domain checks.)
However, since foo.js
is on the same domain than the page you can fetch it with an ajax request. Example with jQuery:
$.get('foo.js', function(source_code) {
alert('foo.js contains ' + source_code);
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…