Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add File To HTML Document 1

Status
Not open for further replies.

SilverElectron

Programmer
Apr 10, 2003
23
0
0
CA
I'm trying to figure-out how to insert data from a separate include file into an HTML page. Sort of like how you can add a javascript file into an HTML page by typing <script src="somefile.js"></script> but with HTML data instead of a script.

I don't want to use frames and the server can't handle CGI, PHP, or ASP. Is there a special tag I could use that is widely compatible? It just has to snag some data from a file and place it on the HTML page.
 
The only way I can think of (without using the server side technology) would be to use javascript. Your script would consist of document.write(' your inserted html code ') and you would still use the same syntax to incorporate it into your website:

<script type="text/javascript" src="somefile.js"></script>

The bad side of this is that people without javascript (and search engine spiders like google's) won't see any of the inserted content.

There is also a server side solution which is called server side includes:

<!--#include file="somefile.html"-->

or

<!--#include virtual="path/to/somefile.html"-->

pages with .html (or .htm) extension usually don't parse this information and not all servers support server side includes. Ask with your provider if they offer you this option and ask them which extensions are they parsing. Hope it helps.
 

Why not just include an iframe, and set the SRC of the iframe to be your other HTML file? No JS, or SSI needed at all, that way.

Hope this helps,
Dan
 
I think I'll go with an iframe, the reason I didn't before was because I didn't think it was compatible with Mozilla & Netscape; it is. Well I have my solution, thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top