I want to include an HTML page inside an HTML page. Is it possible?
I don't want to do it in PHP, I know that in PHP, we can use include
for this situation, how can I achieve the same purely in HTML without using the iframe
and frame
concept?
Use the object Tag as an Alternative to Iframe in HTML The object tag is an alternative to the iframe tag in HTML. We can use the tag to embed different multimedia components like image, video, audio, etc. The object tag has an attribute data where we can define the URL of the webpage to be embedded.
You just have to include it again wherever you use the <div data-include="/path/to/include. html"></div> .
To load external HTML into a <div>, wrap your code inside the load() function. To load a page in div in jQuery, use the load() method.
You can use an object element
<object type="text/html" data="urltofile.html"></object>
or, on your local server, AJAX can return a string of HTML (responseText) that you can use to document.write a new window, or edit out the head and body tags and add the rest to a div or another block element in the current page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With