Rajasekar
Rajasekar

Reputation: 18978

Include HTML file in another HTML file WITHOUT server. Is that Possible?

I am having a header which it will be uniform in all the pages. I want to make it generic. So I want to include common header in every HTML Page.

When i checked for HTML includes i cameup with SSI which needs a server. My Requirement is I want to include HTML file in another WITHOUT a server.

Upvotes: 4

Views: 2609

Answers (4)

Wizard
Wizard

Reputation: 79

You could have a <div> for the header, I will call it <div id="header">. Using jQuery we could say something like: $('#header').load(---html file---);. Aside from the pain it might be to include the JS file in all pages, it will allow you to make changes to the header globally throughout your application.

Upvotes: -1

David Sykes
David Sykes

Reputation: 49882

This later question got an answer that works with files on disk provided you are using firefox.

Chrome gives a cross site scripting error

Upvotes: 0

SamStar
SamStar

Reputation: 335

The way I would do it would be to make a "hanger" div with a class of .header. Then put a <p> inside the div to put alt text into. Then in your main css stylesheet apply your header image as a background image, and negatively indent the text.

Example
.hanger {background-image:url(header.png); text-indent:-1000px;}

To resize the header all you would do is put a width and height on div.hanger.

Does this help?

Upvotes: 1

apak
apak

Reputation: 55

I've never heard of including html in another html file. I think what you can trying to do can be accomplished using an iframe.

example: header.html

Upvotes: 0

Related Questions