Forum Moderators: open

Message Too Old, No Replies

"client-side" #include - Is there a browser that supports it?

         

kaled

10:08 am on Jul 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



We all know that <!--#include.... can be used to cause html fragments to be inserted into pages by the server. However, is there any reason why a browser, on seeing the same thing should not do the same thing?

Ok there's more to server-side #include than just inserting files but this probably accounts for the greatest usage so why do browsers not attempt client-side includes? It would sure make testing of sites under development (on a PC) a lot easier.

So is there a browser that can do this, perhaps an extension for Firefox?

Kaled.

Span

11:09 am on Jul 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What you need is an editor that supports this. That shouldn't be too difficult I guess. Even my PageSpinner can do that. But that's Mac-only.

BlobFisk

11:10 am on Jul 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




...so why do browsers not attempt client-side includes?

I can think of one huge reason straight away: security. Technically (we're all aware of the many security holes around!) client side code should not be able to have any interaction with anything other than the browser.

Client side code is run on the client side, as part of the HTTP request. So the server has sent all the information needed to render the page and the client parses the client side code. For a script to read a file (on the server) would need another HTTP request.

HTH

kaled

3:40 pm on Jul 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



With respect, I cannot see a security concern. It has always baffled me that there is no #include standard in HTML. However, client-side includes do exist in another form. For instance, the <SCRIPT>, <IFRAME>, <FRAME> and <IMG> tags all use a client-side include via the SRC attribute.

It is very easy to imagine a <DIV SRC=url>your browser needs updating</DIV> tag definition. I can see no way that security would be compromised by this.

However, even if security were an issue (but I cannot see how) it could be made an option that can be enabled or made available only when files are located on the local computer.

Kaled.