Solved

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

Posted on 2008-06-13
7
235 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
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 transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now