user3851486
user3851486

Reputation: 109

How to access file of previous directory in web pages?

I have one of my webpage in a folder but want to access url outside this folder .How can I do this?I know its a very basic question but I don't know the solution.So pls help!!
my webpage x/folder/index.html
I want to access :x/index.html

Upvotes: 0

Views: 3699

Answers (2)

Grice
Grice

Reputation: 1375

You can access files outside your current directory with relative paths. Try using .. to move up a directory.

For example, If you are in x/folder/index.html and you can use the path ../index.html to get `x/index.html'

Upvotes: 0

user3851486
user3851486

Reputation: 109

Here is all you need to know about relative file paths:

Starting with "/" returns to the root directory and starts there
Starting with "../" moves one directory backwards and starts there
Starting with "../../" moves two directories backwards and starts there (and so on...)
To move forward, just start with the first subdirectory and keep moving forward

Upvotes: 3

Related Questions