John
John

Reputation:

Read in a file with straight html

In an enviroment where I can't use scripting language, and must use straight html, and I need to render the contents of a file in a webpage. Is there a way to do this? Or is a scripiting language required.

Upvotes: 0

Views: 200

Answers (6)

mas
mas

Reputation: 1117

If the file just changes from time to time and its content format is appropriate you could re-write the web page using a server-side script at an appropriate interval and it can then be read by clients using standard HTML.

The server-side script need not be part of, or even known to the web server software (for example it could be a bash script or a standalone program run via a cron job).

Upvotes: 0

lungic
lungic

Reputation: 344

Probably not very helpful but if your data is in XML file, you could always try XSLT?

Upvotes: 0

rob
rob

Reputation: 6247

If you just can't do PHP or anything similar, you could also try SSI, which I think is pretty standard: http://www.htmlgoodies.com/beyond/webmaster/article.php/3473341

Just curious; why can't you use a scripting language? Does the file reside on a local fileshare instead of a web server?

Even if you can't do any server-side scripting, you could probably use some JavaScript/AJAX to read the file and render it nicely: http://www.dynamicdrive.com/dynamicindex17/ajaxincludes.htm

Otherwise, the iframe suggestions others have posted should do what you need.

Upvotes: 1

Tim
Tim

Reputation:

No, HTML can't do any dynamic scripting..

Upvotes: 0

Jon W
Jon W

Reputation: 15806

It's been a while since I've done straight HTML, but couldn't you use an <iframe> or <object> tag and point the src= attribute to the text file in question? Or is special rendering needed for the file?

Upvotes: 0

Nick Presta
Nick Presta

Reputation: 28665

<object type="text/plain" data="path/to/plain/text/file.txt">
    <p>Your browser must support the OBJECT element.</p>
</object>

That is the only effective way I can think of. IFRAMES/FRAMES work too, in a similar fashion.

Upvotes: 3

Related Questions