How can I tell in JavaScript what path separator is used in the OS where the script is runnning?
Why do you need this when Javascript is run inside the browser with complete OS isolation? You can't access files from your local computer...
Afair you can always use / as a path separator, even on Windows.
Quote from http://bytes.com/forum/thread23123.html:
So, the situation can be summed up rather simply:
All DOS services since DOS 2.0 and all Windows APIs accept either forward slash or backslash. Always have.
None of the standard command shells (CMD or COMMAND) will accept forward slashes. Even the "cd ./tmp" example given in a previous post fails.
VVS's answer is correct, with the exception of parsing a path given by a file input in internet explorer (tested with IE8 - I do not know about other versions). In this case, the path given by the input element's value (input.value) is in the form "C:\fakepath\<filename>". Note the backslashes here.