Forum Moderators: open
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.
...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
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.