Embed text files in html

damoiser picture damoiser · Oct 11, 2013 · Viewed 57k times · Source

I would like to display the content of a text file inside a HTML page (.rtf, .txt, .log,...) stored on the server.

I have tried with embed but seems that doesn't work.

<embed src="/path_to_text_file/text.rtf" width="500" height="300">

There is a "simple" method (or tag) to do that or I should scan for the content and print it with, for example, jQuery?

Answer

JonasT picture JonasT · Oct 11, 2013

Something like this should do it:

<object data="/path_to_text_file/text.txt" type="text/plain"
width="500" style="height: 300px">
<a href="/path_to_text_file/text.txt">No Support?</a>
</object>