If the string used to split pathname (upnsf) is not found, split[0] + ".nsf/"
will return pathname + ".nsf/". In other words, path will be longer than
pathname. The IF statement handles this by trying to split pathname with a
different string (lownsf). Use lownsf or upnsf as the first pass as your
environment's naming convention dictates.
Is is perfect. No. Somewhere, for some reason, there are files out there files
with extensions like ".nSf", ".NSf", etc.
Thanks for the word about toUpperCase and toLowerCase.
You're right. My work-around would fail from the root/home page.
How about this?
***** var lownsf = ".nsf"; var upnsf = ".NSF";
path = location.pathname.split(upnsf)[0] + '.nsf/';
if(path.length > location.pathname.length) { path = location.pathname.split(lownsf)[0] + '.nsf/'; } *****
If the string used to split pathname (upnsf) is not found, split[0] + ".nsf/" will return pathname + ".nsf/". In other words, path will be longer than pathname. The IF statement handles this by trying to split pathname with a different string (lownsf). Use lownsf or upnsf as the first pass as your environment's naming convention dictates.
Is is perfect. No. Somewhere, for some reason, there are files out there files with extensions like ".nSf", ".NSf", etc.
Thanks for the word about toUpperCase and toLowerCase.
David