Re: Include pieces of code in an HTML file

> Is there a way in XHTML 1.0 or HTML 4.0 to include a piece of code in an HTML
> file from another file?

We had this discussion about a year ago, in the context of whether
<object type="text/html"> could be used as a client-side include to
drop HTML code right into a document, as with server-side includes, or
if it produced a document in a sub-window, like <iframe>.  IMHO a
client-side include mechanism is a bad idea, since it doesn't degrade
at all; authors have a lot more control over the servers they run on
than they do on any conceivable browser that could be used to access
the page (which is also why CGI is better than client-side scripting
in cases where either will work).

The most logical interpretation of <object type="text/html"> seems to
me to be as a full document in a sub-window, which means that <iframe>
might as well stay deprecated and effort be devoted instead to getting
<object> better supported.  (There is the issue of targeting, but
allowing <object>s to be targeted (either through a re-interpretation
of the 'name' attribute or even better by changing to convention to
target by 'id' instead) will reap benefits in other contexts as well.)

As for inventing a new <include> element:

> Similarly, IFRAME is not supported but a
> lot of browsers, and you cannot rely on pages that are visible
> correctly only if you have IE5 ;-)

Er, I don't follow the logic here; you want to invent a new element that is 
currently supported *nowhere* because the existing elements that serve the same 
purpose are not widely enough supported?!

It seems like a much wiser course of action would be to lobby for a
modification of <object type="text/html"> to suit your needs.  Any of
the attributes you propose for <include> (not to mention the question
of whether to render in a subwindow or merely include the code) could
be used as <param>s within an <object type="text/html">.

					John T. Whelan
					whelan@iname.com
					http://www.slack.net/~whelan/

Received on Thursday, 30 September 1999 06:52:51 UTC