Solved

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

Posted on 2008-06-13
7
238 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
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…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

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