Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

insert HTML code from file into HTML page



10:44 pm on Oct 16, 2008 (gmt 0)

5+ Year Member

I have around 100 web pages on a site. Most of these pages are the same, except for some HTML.

I'd like to #include the complex, bulk HTML from a file into each page, so that I can easily change the bulk HTML in one place and have it "appear" when the other pages get loaded into a browser.

The bulk HTML has seven <div's> in it, some with tables and text and images, etc.

I cannot use PHP or server-side scripting to php-include etc, because this has to run offline.

I tried using:

<object type="text/html" data="myFile.htm"></object>

but it doesn't place the clean HTML cleanly into the page -- it appears in some kind of scrolling div or something.

I also tried using the DOM to create a text node, but couldn't get the div's in the bulk file to actually appear in the page.

Any ideas?



2:35 am on Oct 17, 2008 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

Run PHP offline in batch mode to produce static pages maybe ?


7:47 am on Oct 17, 2008 (gmt 0)

5+ Year Member

I did have the <object> solution working yesterday, but I must have changed something, somewhere, because it doesn't work anymore (not that it's very complex).

What I see now when I look at the page source in the browser is:

<object data="foo.htm">

whereas before, when it worked, I saw the expaned foo.htm inline in the page code.

Go figure.


Featured Threads

Hot Threads This Week

Hot Threads This Month