Embed text files in html

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>

An iFrame might be useful in this context.

<iframe src="/path_to_text_file/text.rtf" width="500" height="300" frameBorder="0">

is only for plugin content (flash, etc). Try getting content using ajax, then write it with document.write; Or use the include tag in a back end language (PHP, ASP, etc)


Using a $.ajax() function with a .append() function inside you can easily grab the contents of a text document and display them on the page. Something along the lines of what you see below. Preform this on load of the page to immediately load the file in with the rest of the page.

$.ajax({
        async:false,
        url: 'folder/file.txt',
        dataType: 'text',
        success: function(data) 
        {
        $('element').append(data);
            }
        });

Play around with it a little bit to get the correct result you are looking for. You could also use PHP but unless you really need to parse the data, PHP is a bit overkill in this situation.