Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed text files in html

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?

like image 818
damoiser Avatar asked Oct 11 '13 17:10

damoiser


People also ask

Can HTML read text file?

HTML 5 provides a standard way to interact with local files with the help of File API. The File API allows interaction with single, multiple as well as BLOB files. The FileReader API can be used to read a file asynchronously in collaboration with JavaScript event handling.


1 Answers

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>
like image 122
JonasT Avatar answered Oct 26 '22 18:10

JonasT