Solved

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

Posted on 2008-06-13
7
239 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

809 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