0

I ́m working in a local project (offline) and need show a txt file outside of directory of html. How implement the relative path?

main-app
|
|-core-app
|
|-logs
| |-log-file.txt
|
|-plugin
 |-plugin-core
 |-www
 |-index.html

The file is on logs folder, I need show it in index.html. I try to use src="../../../logs/log-file.txt" but don't work. An example of the code in html:

<object type="text/plain" data="../../../logs/log-file.txt"></object>
sohel khalifa
5,5863 gold badges36 silver badges46 bronze badges
asked Oct 11, 2012 at 12:40
3
  • relative is allways relative to the root folder, so /logs/log-file.txt should work. Commented Oct 11, 2012 at 12:42
  • In the plugin folder have a plugin that run a webserver for html, the root of this webserver is the directory WWW. So, I need load the file inside the logs folder. I read in some site that in html, relative paths only works at level 2, in local files. Above this, only in webservers. This true? Commented Oct 11, 2012 at 13:27
  • if the webserver is at the www directory, you cannot access the logs directory since it is outside the web root.. you will need to do it with server side code, get the code into a variable, and print it on the html or inside the data. Commented Oct 11, 2012 at 13:57

2 Answers 2

3

relative to index.html I think that it should be : data="../../logs/log-file.txt". One less directory shift.

answered Oct 11, 2012 at 12:44
Sign up to request clarification or add additional context in comments.

Comments

-2

Just change the .txt file to a .html file, and add styling... It works just fine, just add a linkto it in index.html.

answered Oct 11, 2012 at 12:46

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.