specifying paths

J

Jeff

I don't have much knowledge of javascript, but need to place a very small
amount in a web page. I figured out everything other than how to properly
call a page in another folder/directory. Apparently javascript doesn't like
some of the dos and unix conventions with which I'm familiar. Could someone
tell me now to properly specify a path name in javascript (i.e., how to
refer to a page that is in the parent folder similar to below, which doesn't
work)

~\Comments.htm


Thanks

Jeff
 
D

David Dorward

Jeff said:
I don't have much knowledge of javascript, but need to place a very small
amount in a web page. I figured out everything other than how to properly
call a page in another folder/directory. Apparently javascript doesn't
like some of the dos and unix conventions with which I'm familiar. Could
someone tell me now to properly specify a path name in javascript

JavaScript doesn't come with any functions to access files, they are all
provided by the host environment. The syntax depends on the what you are
passing this "path name" to, but I can't think of any browser based
examples where it is different to a normal URL (relative or otherwise).
(i.e., how to refer to a page that is in the parent folder similar to
below, which doesn't work)
~\Comments.htm

Umm. The UNIX convention is that ~ is shorthand for "the current user's home
directory", a concept that doesn't exist in URLs (although some systems
map /~username/ onto a user specific directory
(typically /home/username/public_html)).

UNIX file paths use "/" as the seperator, not "\" though.

Further reading:
http://www.utoronto.ca/webdocs/HTMLdocs/NewHTML/url.html
http://www.iusmentis.com/technology/www/relativeurls/
http://www.ietf.org/rfc/rfc1738.txt
http://www.ietf.org/rfc/rfc1808.txt
 
J

Jeff

David Dorward said:
Umm. The UNIX convention is that ~ is shorthand for "the current user's
home
directory", a concept that doesn't exist in URLs (although some systems
map /~username/ onto a user specific directory
(typically /home/username/public_html)).

UNIX file paths use "/" as the seperator, not "\" though.

Further reading:
http://www.utoronto.ca/webdocs/HTMLdocs/NewHTML/url.html
http://www.iusmentis.com/technology/www/relativeurls/
http://www.ietf.org/rfc/rfc1738.txt
http://www.ietf.org/rfc/rfc1808.txt

I'm sure that I wasn't using the correct terminology to describe the
question accurately. ...and part of the problem is that I'm mixing asp.net
with a small bit of java.

One of the pages that you provided gave me the answer, however.

.../../comments.htm

got me to the right page.

Thanks
 
D

David Dorward

Jeff said:
I'm sure that I wasn't using the correct terminology to describe the
question accurately. ...and part of the problem is that I'm mixing asp.net
with a small bit of java.

Java and JavaScript are entirely different languages (and you can write ASP
in JScript which is Microsoft's version of JavaScript)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top