Solved

Make a HtmlEditor: Why an IFrame and not a Div?

Posted on 2008-06-13
7
240 Views
Last Modified: 2011-09-20
Why do they make HtmlEditors out of an IFrame? The tag was depricated in 97 and we have an Object tag.

Why not even make a div and just listen to gotfocus/lostfocus events to emulate a text area?

What functionality does an IFrame give us that is so valuable?
0
Comment
Question by:msmyers
  • 3
  • 3
7 Comments
 

Author Comment

by:msmyers
ID: 21782511
Ok i found out that we can simply say iframe.execCommand(bold) and it will bold the selected text. But can't we get that functionality with controller.makeBold(controller.getSelectedText(div)) too?!

What is unique about an IFrame? Is this the only practical way to make an editor?
0
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 250 total points
ID: 21783216
msmyers,

The big reason is most likely compatibility.  Both across versions and between different browsers.  The iframe tag provides a nice option that is pretty equally supported.

To clarify one thing, to my knowledge the iframe tag has never officially been deprecated.  It was not included in XHTML specs and the object tag does seem to be the preferred method for the future but since it was never deprecated the support for iframe should remain for a while.  As long as loose DTD's are supported in specs that have iframe.  Until it is officially deprecated I would suggest it is pretty safe to use for its unique purposes.

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 21783808
AN iframe can do much more than you realize.  An iframe is a PAGE within a PAGE -- you can insert an entire google search page into an iframe.  It is very powerful, and if supposedly deprecated, well, that is a huge mistake.  There is no other easy way to embed a complete webpage into a page, like an iframe does.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Closing Comment

by:msmyers
ID: 31618585
Meh, its what i expected to be the reason, but I was looking for a real solid reason i hadn't thought of before.. But sometimes the simplest is the answer.
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 21783901
I don't use it much for embedding web pages but the method with the object tag is like the html below.  That exact html was tested and worked in Firefox.  The EE domain didn't work testing on my local web server with IE7 but change the URL to a file on the same domain/server and it worked in both.

I won't be surprised if there are limits to object working when iframe does so I still use it as the first option when I need it and the doctype will allow.  It is good to know there are options and the object tag can handle many different types of files (http://joliclic.free.fr/html/object-tag/en/).

bol
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link href="/style.css" rel="stylesheet" type="text/css" />
<title>HTML page in page w/ object</title>
</head>
 
<body>
<h3>Embedding an html page with object tag</h3>
 
 
<p>This is content from the main page.  See how bland it is.</p>
 
<br /><br />
<object data="http://www.experts-exchange.com/M_3599182.html" type="text/html" width="300" height="200">
  alt : <a href="http://www.experts-exchange.com/M_3599182.html">test</a>
</object>
 
</body>
</html>

Open in new window

0
 

Author Comment

by:msmyers
ID: 21783913
I appreciate the follow up.

0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 21783947
Actually I worked on it and posted it before I saw your close.  I am glad you appreciate it.

Re: Grading comment
Simple answers usually are best. :)

bol
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question