P
pbd22
Hi -
I have code that automatically fills tabs on a page. In some cases, a
URL path won't be correct (the folder and files don't exist) and, in
these cases, I want to catch these exceptions and move the logic to
the next instance in the loop (again, testing if the URL path exists).
I have a check_path function for these cases with the following code:
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
if (!oFSO.FolderExists(fold)) {
alert("Folder does not exist!");
}
else if (!oFSO.FileExists(file))
{
alert("File does not exist!");
}
The problem is that the first line keeps causing the logic to fail.
when i try/catch the code, I get an "undefined" error that seems
to come from the ActiveXObject("Scripting.FileSystemObject") part.
My Question(s) Is:
a) Is this the best way to test to see if a URL path exists in
javascript?
b) If it is, why does the oFSO = new ActiveXObject... part keep
throwing an 'undefined' error?
I thank you.
I have code that automatically fills tabs on a page. In some cases, a
URL path won't be correct (the folder and files don't exist) and, in
these cases, I want to catch these exceptions and move the logic to
the next instance in the loop (again, testing if the URL path exists).
I have a check_path function for these cases with the following code:
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
if (!oFSO.FolderExists(fold)) {
alert("Folder does not exist!");
}
else if (!oFSO.FileExists(file))
{
alert("File does not exist!");
}
The problem is that the first line keeps causing the logic to fail.
when i try/catch the code, I get an "undefined" error that seems
to come from the ActiveXObject("Scripting.FileSystemObject") part.
My Question(s) Is:
a) Is this the best way to test to see if a URL path exists in
javascript?
b) If it is, why does the oFSO = new ActiveXObject... part keep
throwing an 'undefined' error?
I thank you.