Registered: March 14, 2007 | Reputation: | Posts: 6,747 |
| Posted: | | | | Hi,
I try to use a Scripting.FileSystemObject in my HTML window to determine whether a certain file exists. In the preview this works like a charm but the final HTML window doesn't show anything.
Is there another way? | | | Karsten DVD Collectors Online
|
|
Registered: March 14, 2007 | Reputation: | Posts: 1,029 |
| Posted: | | | | The Scripting.FileSystemObject is marked as not safe for scripting. If you open a HTML page that uses it in IE, you will get a security warning. Depending on your IE settings, you may be able to proceed with the object creation. In DVDProfiler's HTML windows, creation of unsafe objects is not possible.
You either have to write your own helper object that is safe for scripting, or you can use the following crude hack:
var oXml = new ActiveXObject("msxml2.DOMDocument"); oXml.validateOnParse = false; oXml.resolveExternals = false; oXml.async = false; oXml.load("<filename>");
This will of course always fail, unless your file is indeed an XML file, but you will get different error codes, depending on the reason.
switch (oXml.parseError.errorCode) { case -2146697210: // File not found break; case -2147024893: // Path not found break; default: // File exists } | | | Matthias | | | Last edited: by goodguy |
|
Registered: March 10, 2007 | Posts: 4,282 |
| Posted: | | | | Matthias is correct and this is by design to prevent malicous scripts within uploaded layouts. | | | Invelos Software, Inc. Representative |
|
Registered: March 14, 2007 | Reputation: | Posts: 6,747 |
| |
Registered: March 14, 2007 | Reputation: | Posts: 6,747 |
| |