473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Why we should avoid iframe?

Since it is part fo the standard, why I always heard that we should
avoid iframe?

any comments?

thanks.

May 24 '07 #1
6 10541
howa wrote:
Since it is part fo the standard, why I always heard that we should
avoid iframe?

any comments?

thanks.
Depends which standard you're referring to. The <iframeelement only
exists in HTML 4.01 Loose, and in XHTML 1.0 Transitional and Frameset.

The part about avoiding <iframereally applies to all uses of frames.
There are, for the most part, better ways to include shared content
than using frames (including <iframe>).

--
Kim André Akerĝ
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
May 24 '07 #2
howa wrote:
>Since it is part fo the standard, why I always heard that we should
avoid iframe?
Kim André Akerĝ <ki******@NOSPAMbetadome.comwrote:
The part about avoiding <iframereally applies to all uses of frames.
There are, for the most part, better ways to include shared content
than using frames (including <iframe>).
Exactly. None of the problems with frames listed in the FAQ* have anything
to do with browser support or whether frames are part of any given
specification, and all are equally applicable to inline frames.

And some of us find that disabling inline frames (at least for unknown,
untrusted sites) is an effective way to reduce annoying ads and other
stupid web tricks.

* http://www.htmlhelp.com/faq/html/fra...frame-problems
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"Do not look where you fell, but where you slipped." - African Proverb
May 24 '07 #3
On 24 May, 08:08, howa <howac...@gmail.comwrote:
Since it is part fo the standard, why I always heard that we should
avoid iframe?
Why do you need an <iframe? Is there a better way of doing it ?
I'd generally avoid it in favour of something better, but I wouldn't
rule it out altogether.
As a minor issue, <iframeisn't in all of the doctypes. This is no
reason to not use <iframe>, but if you're going to use it anyway, at
least choose a doctype for which it's valid.
There are several potential reasons that you might use <iframe>, some
better than others.

* To wrap some changing content up in a constant menu structure
(typical frame usage)

* To statically include boilerplate text

* For AJAX-like purposes involving HTML data sources rather than XML
(e.g. screen-scraping from HTML pages)
The first of these is perhaps the most commonplace. It has the great
advantage (like all frames techniques) of simplicity, and the
disadvantage of many small drawbacks. Overall, it's best avoided. In
practice, it's worth knowing about and still worth using if you don't
have the time / needs / skills to build something better.

It's particularly useful if you have a client-side "report viewing"
page with a single embedded report that's chosen from a list on the
container page (just as an example). Trivial HTML coding gives you a
selectable list or reports that appear in-line on the same page. It's
particularly useful if it's a set of _files_ that you're viewing here,
rather than documents from a web server (so you don't have the option
to use server-side coding). I have dozens of these myself, reporting
on the current status of our many products. Python scripts and XSLT
generate the report pages and the index page, then they're linked by
an <iframe>. Moving this to a web server would be a problem (for other
reasons), so it suits me to just keep them on the filesystem. If
they're only there as static files, I'm restricted in the techniques I
can use, but <iframestill works.
The second is really a "poor man's SSI". Avoid this. Avoid this
strongly, in favour of real SSI. Any competent hosting offers SSI, so
use it (or move to hosting that does allow it).

My current project uses a vast numbe of legacy <iframe>s, as a poor
substitute for JSP tag libraries. This separates "technical web
coders" from "application coders" who each work on separate files.
It's arguably better than having everyone dive into one large and
uncontrollable shared file, but the real solution would be a neat use
of tag libraries, not this client-side aggregation of page sections.
The third is interesting. AJAX is widely popular now, but the "X" in
AJAX stands for XML not HTML and so it's impossible to use this
technique with a non-XML HTML page, or a non well-formed XHTML page.
XmlHttpRequest et al only work for parsing XML documents. The work-
around is to use an <iframeand to dynamically load new content into
it with client-side JavaScript. The <iframe(and the browser) act as
your HTML parser. The <iframecan of course be hidden from display,
just used from program code.
<iframealso has efficiency issues, as it represents two HHTTP
requests to assemble a page that can probably be supplied through just
one (if assembled server-side first). That's a very minor point though
- any typical page will have a great many separate requests
regardless, <iframe>s are one of the last places to start counting and
optimising these away.

May 25 '07 #4
Andy Dingley wrote:
AJAX is widely popular now, but the "X" in
AJAX stands for XML not HTML and so it's impossible to use this
technique with a non-XML HTML page, or a non well-formed XHTML page.
I wrote an AJAX chat that uses no XML or XHTML. The data passed to the
web page does not have to be XML. It can be anything that Javascript can
parse into valid HTML (or XHTML, depending on your DocType).
May 25 '07 #5
On 5 25 , 4 59 , Andy Dingley <ding...@codesmiths.comwrote:
On 24 May, 08:08, howa <howac...@gmail.comwrote:
Since it is part fo the standard, why I always heard that we should
avoid iframe?

Why do you need an <iframe? Is there a better way of doing it ?
I'd generally avoid it in favour of something better, but I wouldn't
rule it out altogether.
there are two strong reasons:

1. solve the cross-domain problem
2. make the original page cachabale

May 25 '07 #6
On 25 May, 15:38, Scott Bryce <sbr...@scottbryce.comwrote:
I wrote an AJAX chat that uses no XML or XHTML.
So is that AJAX, or "AJAX-like asynchronous JavaScript using an
alternative parser"? Purely a terminology point.
The data passed to the web page does not have to be XML.
It does if you're going to use XMLHttpRequest with it. If you don't,
then you can use anything you can build a parser for. For HTML, that
may well be an <iframe>.
May 25 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: el_roachmeister | last post by:
Is there a way to make a text link post to a form without passing all the parameters in the url? The urls tend to get very long and messy. I often wonder if there is a limit to how long they can...
2
by: Csaba2000 | last post by:
I want to be able to embed a single quote into an INPUT element within a dynamically generated IFRAME. The example below shows how the IFRAME is generated. Challenge: I'd like the alert box to...
7
by: Christopher J. Hahn | last post by:
I'm trying to use a script-generated form to submit to a script-generated iframe. The problem I'm running into is that the iframe is not assuming the name I assign it. IE6 on Win2000. FF1.0.2+...
1
by: jaktharkhan | last post by:
Hi, I really really need help in trying to figure out how can I do a CloneNode on an Iframe where the cloned IFRAME clones with all its contents?. Basically what I am doing is dynamically building...
1
by: gkellymail | last post by:
I have a small javascript/html code below that demonstrates that problem I'm having in a larger program. I've tried all kinds of things to get it to work, but it just won't do what I want. I've...
27
by: Murray R. Van Luyn | last post by:
Hi, Is using frames in a website as big an issue nowadays as it was maybe 5 or so years ago? I can remember that you used to have to have a frame site, as well as a non frame site for browsers...
0
by: tequilamala | last post by:
I have an Iframe in one of the pages i am developing... the iframe is suppose to scroll up and down and the links target the iframe. the problem is that the iframe scrolls side to side on internet...
1
by: tanyali | last post by:
Hi, I am using asp.net and c# i have an iframe within a page PageA. the source file for the ifram is page PageB. I type in some text and press search from PageA, the result will be displayed...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.