Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to embed one html page in another? 1

Status
Not open for further replies.

royboy75

Programmer
Feb 13, 2007
114
GB
Hello,

Suppose I have two html pages: A and B.
I would like to embed html B inside html A at some point so from this point on the content of html B will be seen. When this content ends the content of html A continues. How do I do that?
 
You'd use an iframe. You can also check at W3Schools.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
Vragabond's answer is correct if you are talking about complete HTML web pages that have all sections - HTML, HEAD, and BODY.

If you have just an HTML fragment without the section headers (e.g. some code that displays a table, a paragraph of text, or your navigation menus) you would use server side includes, aka SSI, assuming your web server configuration supports them.

Mike Krausnick
Dublin, California
 
Ive had very good luck using ajax includes. Useful when you don't have access to SSI.

Let them hate - so long as they fear... Lucius Accius
 
You'd be able to use it for any number of pages simultaneously. I am unaware of a way to set any kind of timing however. ChrisHunt has a good point about the search engines, and the javascript would keep it from being displayed in browsers with js disabled.

Let them hate - so long as they fear... Lucius Accius
 
oops - forgot this part...

Edit the red text to the name of the page desired.

<script type="text/javascript">
ajaxinclude("page.html")
</script>

Let them hate - so long as they fear... Lucius Accius
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top