a.html
ABC
b.html
<!--#include FILE="a.html" -->
XYZ
access b.html: file:///home/kurz/Desktop/b.html
it only shows XYZ
is this not the way to include files in html?
a.html
ABC
b.html
<!--#include FILE="a.html" -->
XYZ
access b.html: file:///home/kurz/Desktop/b.html
it only shows XYZ
is this not the way to include files in html?
If it's apache try
<!--#include virtual="insertthisfile.html" -->
From here:
include virtual and include file do almost the same thing. The difference is that include virtual takes a URL-style path, which is what you probably expect. include virtual can also execute CGI programs, if your web server supports that, and include their output. include file takes a file-system path, and cannot execute CGI programs. Both also accept relative paths, so for a simple case like the above they work the same. If you don't understand the difference between web paths and file system paths, use include virtual.
What you're attempting is called a Server-Side Include (SSI). As such, it requires the pages be running on a webserver, rather than a local file.
When you're requesting the page from a server, the server sees the <!--#include FILE="a.html" -->
preprocessor and performs the SSI.
When you're referencing it directly from your filesystem, such as file:///home/kurz/Desktop/b.html
, all your browser is doing is loading the raw html and interpreting that.
The one you are doing is SSI
-> Server Side Includes
which requires Apache
or IIS
to work.
You need to install Apache
(for windows / unix) or IIS
(for windows) for this to work. Also, you can test this on remote webservers.
Yes, servers are required for server side includes
If its just plain HTML, use iframes... instead of a #include, use :
<iframe src="a.html"></iframe>
If your site is to be XHTML compliant (probably not).. you would need to make further changes