I’m curious as to exactly what the flexibility is for the html5 <object> tag.
If I have a main web page set up like this
<body>
<div id="container">
<object data="??"></object>
</div>
</body>
and in a separate webpage I have this:
<body>
<div id="info">
<p> text text blah blah text </p>
</div>
</body>
Is there a way to pull specifically the html from the “info” div on the secondary page into the object on the primary page? If not, what kind of alternative solution should I look into?
objectis not an HTML5 specific tag, it also existed in HTML 4.01. It is not useful for including pages into other pages, rather it allows the page to contain Java Applets, Flash etc. The only HTML solution for including pages is theiframetag.You should instead insert some JavaScript that makes an AJAX call to fetch the second page. Parse it using
innerHTML. Then you can select the desired element usinggetElementByIdand insert it into thecontainerdiv.If you want to do it from the server side, have a look at PHP…