Alright I tested the following code on my local Apache server:
<script type="text/javascript">
function httpGetText(aURL) {
var req = new XMLHttpRequest();
req.open('GET', aURL, false);
req.send(null);
return req.responseText;
}
document.write(httpGetText('http://localhost/somedir/'));
</script> I created a temporary directory called 'somedir' and it worked. However, if I added an index.htm file into the directory it just returned that file rather than the list of files. Basically, that means that directory scans can only be performed on server's whose default behavior is to return the list of files within that directory; provided of course there isn't an index page or that it doesn't return a 404 or other such error code.