Web Weenie Posted February 18, 2010 Share Posted February 18, 2010 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... Link to comment Share on other sites More sharing options...
Ingolme Posted February 18, 2010 Share Posted February 18, 2010 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 More sharing options...
RobberBaron Posted February 18, 2010 Share Posted February 18, 2010 [never mind] Link to comment Share on other sites More sharing options...
Web Weenie Posted February 18, 2010 Author Share Posted February 18, 2010 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 More sharing options...
Ingolme Posted February 18, 2010 Share Posted February 18, 2010 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 More sharing options...
jeffman Posted February 18, 2010 Share Posted February 18, 2010 . . . you might want to consider PHP includes. FWIW Link to comment Share on other sites More sharing options...
Web Weenie Posted February 20, 2010 Author Share Posted February 20, 2010 I went with iframes to solve the problem. This mimicked what I had before and didn't cause any issues that I've found so far.I'll have a look at PHP includes for future solutions.Thanks for the assist. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.