Jump to content

Displaying Html File Within Div


Web Weenie
 Share

Recommended Posts

I'm having a problem with displaying an external html file within a div...This works in Safari without error;<div id="myPane" style="width:620px; height:445px; z-index:1;"> <object type="text/html" width="620" height="445"> <embed src="Blogs/blog-2-10.html" width="620" height="445"></embed></object> </div>and my javascript (called from links);function getblog(thispage) {xurl='<object type="text/html" data='+thispage+' width="620" height="445"><embed src ='+thispage+' width="620" height="445"></embed></object>';document.getElementById("myPane").innerHTML = xurl;}This produces an error in Firefox stating there is a missing plugin. How do I avoid this error?I couldn't find anything on this...

Edited by Web Weenie
Link to comment
Share on other sites

Use the <iframe> element for that:

<iframe src="Blogs/blog-2-10.html" width="620" height="445"></iframe>

$The question is if this is really what you want to do. You might be better off using Javascript AJAX requests to load specific content into the div instead.

Link to comment
Share on other sites

Use the <iframe> element for that:
<iframe src="Blogs/blog-2-10.html" width="620" height="445"></iframe>

$The question is if this is really what you want to do. You might be better off using Javascript AJAX requests to load specific content into the div instead.

Hmm, I was under the impression that iframe was to be avoided... Is this wrong?I'll see if I can find an AJAX example for this, but I'm afraid this this might be out of my league at the moment.Thanks for the help.
Link to comment
Share on other sites

Hmm, I was under the impression that iframe was to be avoided... Is this wrong?I'll see if I can find an AJAX example for this, but I'm afraid this this might be out of my league at the moment.Thanks for the help.
Using the <object> tag to substitute the <iframe> is an even worse alternative. The reason to avoid the <iframe> is because it's really bad for navigation. It's confusing to the users who don't know what to expect when clicking the back button and it requires loading more than one document at a time.If what you want is to load different content with the same layout, you might want to consider PHP includes.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...