2

I would like to determine the path of "my documents" folder with Javascript. I need it to specify the folder where I could store the logs of my application.

Thanks

Celero
  • 445
  • 2
  • 6
  • 19

2 Answers2

2

Use the SpecialFolders-method of the shell:

shell = new ActiveXObject("WScript.Shell");
pathToMyDocuments = shell.SpecialFolders('MyDocuments');

http://msdn.microsoft.com/en-us/library/0ea7b5xe%28v=vs.85%29.aspx

Dr.Molle
  • 116,463
  • 16
  • 195
  • 201
1

You can't access client file system with Javascript for obvious security reasons.

Giann
  • 3,142
  • 3
  • 23
  • 33
  • 1
    I'm using IE and ActiveX for my application, you can allow a trusted activeX to access your file system...Or so, I believe – Celero Jun 29 '11 at 09:45
  • I really wouldn't recommend it. – Giann Jun 29 '11 at 09:47
  • Ok, so how could I set a folder for the logs of my application on client side without accessing such informations ? – Celero Jun 29 '11 at 09:49
  • You want to do logging on the client side ?? – Giann Jun 29 '11 at 09:50
  • Yep...It's specific ask from the client (the one who bought the app). I know it sounds strange but... – Celero Jun 29 '11 at 09:54
  • That is not a correct design, and it would require file system access to the client which is unsafe. You will have to explain that to him. – Giann Jun 29 '11 at 09:56
  • 1
    Why is it bad or incorrect for an application to access the file-system? The topic is about an application, not a webpage. So if the user trusts the application, why not doing this(everybody trusts every day hundreds of applications) – Dr.Molle Jun 29 '11 at 11:24