aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes HTML include Page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "HTML include Page" Watch "HTML include Page" New topic
Author

HTML include Page

Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Hi,

I have some static HTML pages, how to include another static HTML page in my page. please assist

I tried
<!--#include FILE="b.html" -->
But its not working.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61772
    
  67

There is nothing in HTML to allow including other resources. You'll need to use whatever server-side include mechanism your web server provides.

What are you using for a web server?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
No web servers.. Simple HTML pages (Static Pages)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61772
    
  67

Without a server, how is anyone able to view your pages?

If they are just opening them as local files in the browser, then there is no include mechanism available. (Although I guess you could fashion one out of some Ajax code, but that would be rather weird.)
marten kay
Ranch Hand

Joined: Feb 03, 2007
Posts: 178

You could use an iframe, for example

sample1.html could have this code


and in the same directory as the above, sample2.html could have this code



with this code, material from sample2.html is included in sample1.html


when in doubt put it in parenthesis and stick a dollar sign in front of it, only good can come from this.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61772
    
  67

An iframe isn't exactly the same thing. It's a fixed size and does not include the enclosed page in the parent page.

Or, is that what the OP meant by "include"?
marten kay
Ranch Hand

Joined: Feb 03, 2007
Posts: 178

definitely, an iframe allows you to get stuff from one page into another and include material in the general sense - not in the specific sense of a server side include. As we don't really know the design requirement that is being addressed here, the iframe may be an option.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTML include Page