Thursday, November 27, 2008

Get Client System's Drive List : JavaScript

The following code tells how to get client systems Drive List.



<SCRIPT language=JavaScript>

//Following function returns the drive list from client system

function getClientDrives() {

var objfs, s, n, e, x;

objfs = new ActiveXObject("Scripting.FileSystemObject");

e = new Enumerator(objfs.Drives);

s = "";

do {

x = e.item();

s = s + x.DriveLetter;

s += ": ";

if (x.DriveType == 3) n = x.ShareName;

else if (x.IsReady) n = x.VolumeName;

else n = "<font color=red>[Other Drive-not intialized]</font>";

s += n + "<br>";


} while (!e.atEnd());

return (s);






<h1>The following is the list of available drives on Client system:</h1>

<SCRIPT language=JavaScript> document.write(getClientDrives());</SCRIPT>





  1. how do i get drive information for webkit browsers in javscript. ActiveXObject does not help me for Google chrome and safari.

    Please Help.

  2. Rakesh - I suggest go for other things, check these links :