HTML and CSS Reference
In-Depth Information
types, it hands the data over to the plug-in and lets it control what is dis-
played in the element. This is how the popular Flash plug-in works; it's
the basis for popular sound and video sites like YouTube and last.fm.
Why href and src and data?
It may seem like the href , src , and data attributes do the same job for different
elements. Why didn't HTML standardize on one or the other? Usually href indi-
cates somewhere a user can go, and src indicates something a browser should
fetch, but it's mostly historical accident whether an element uses one or the oth-
er. It may seem that the <object> element has a data attribute just to force you
to remember a third alternative, but the reasons are mostly historical. Back when
the web was young, some browsers implemented new elements with href and
some with src . The elements that survived to become the first HTML specifica-
tion kept their attributes so as not to break backward compatibility.
Inline frames
Another common way of embedding content in your web page is the
inline frame, known as the <iframe> element. This lets you create an
embedded browser window inside the one the page is rendering in:
<p>Here is another page:</p>
<iframe
src="http://www.userfriendly.org/"
width="320" height="240">
</iframe>
The <iframe> is given dimensions and
an entire other web page has been
loaded into it. The page can be one
from the same site as the parent page,
specially designed to fit within the
bounds of the <iframe> . This is an
easy way to allow parts of the page to
be updated without reloading the
whole thing.
The <iframe> element is used a lot for embedding advertising, display-
ing videos, and Facebook applications.
Search WWH ::




Custom Search