how can I load an html page inside a div. With the 'object' tag it's loading, but I think it's not a good approach. It is not an external file. Is dojo good for this?
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.
The HTML <iframe> tag specifies an inline frame. An inline frame is used to embed another document within the current HTML document.
The onload event can only be used on the document(body) itself, frames, images, and scripts. In other words, it can be attached to only body and/or each external resource. The div is not an external resource and it's loaded as part of the body, so the onload event doesn't apply there.
Use jquery
$("#mydiv").load("myexternalfile.html");
I'm not completely sure what you're looking for, but if you're wishing to display an HTML document inside another HTML document then I think the only way to do this is to use an iframe
. Check out this tutorial: http://www.designplace.org/tutorials.php?page=1&c_id=1
Perhaps you could load the HTML document and strip away the HEAD
and wrapping BODY
elements and then insert the code into the DIV
element.
EDIT: Ah, no iframes
you said. Well, then I propose the latter. ^^
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