| Next Tip?
Home » Javascript

Get Client System’s Drive List : JavaScript

26 November 2008 2,016 views No Comment
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 1.00 out of 5)
Loading ... Loading ...

Get Client System’s Drive List : JavaScript

In many cases if you want to know the drive list of client system using some client scripting then the best one is JavaScript, actually Activex Scripting.FileSystemObject provides the functionality.

<HTML>
<HEAD>

<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>";
e.moveNext();
} while (!e.atEnd());

return (s);
}

</SCRIPT>
</HEAD>

<BODY>
<P>
<h1>The following is the list of available drives on Client system:</h1>
<SCRIPT language=JavaScript> document.write(getClientDrives());</SCRIPT>
</P>
</BODY>
</HTML>

Note:
1. Copy & paste above code save it as DriveList.html
2. Run it from you IE
3. The above is only workable with IE

Popularity: 4%

Post to Twitter Tweet This Post

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Ads by Lake Quincy Media

Leave your response!

You must be logged in to post a comment.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes