 <p>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.)</p> <p>However, since <code>foo.js</code> is on the same domain than the page you can fetch it with an ajax request. Example with jQuery:</p> <pre><code>$.get('foo.js', function(source_code) { alert('foo.js contains ' + source_code); }); </code></pre>