Why Are Frames Deprecated in HTML

Why are frames deprecated in html?

Jakob Nielsen wrote a 1996 column that criticized frames. Some key points:

  1. Frames prevent users from properly bookmarking pages. When a bookmarked frameset page is loaded, users' previous mouse clicks inside the frames do not matter. Only the outer URL is saved, and users have to navigate to where they were manually.

  2. Frames present challenges for printing web pages. Printing all the frames at once is not suited to the different dimensions of paper (and users can get only the first pageful that way). Users generally have to right-click the frame they want and choose the appropriate context menu option.

  3. Users coming from search engines may not have access to navigational elements if they are located in another frame — they are directed to only that frame the search engine found the text in.

While "framesets" (the most common type used on late 1990s/early 2000s web pages) are dying, the iframe (short for inline frame) remains alive and well. In fact, recently iframes have been found useful in today's "mashup" web applications, and extensions to the iframe are currently proposed in the HTML5 specification.

For example, Facebook, in its API for app developers, uses them to seamlessly integrate third-party apps with their own site while minimizing the security risk. (In this model, all third-party code remains on a separate domain, which is good for security reasons.)

Frames deprecated in HTML5 but not iFrames

Inline frames are used to embed "plugins" into parts of a page. Seen google maps on a website before? Those are iframes.

Actual frames on the other hand are quite pointless. They're virtually never used in professional websites. If you ever go to a high school you may see IT projects that use frames for "navigation bars" or something. They take up half the page (or however you configure it) and are loaded as a separate page.

Simply put: iframes can be used as plugins. Frames are inelegant and not very useful

Edit:
To be more specific, iframes and frames are quite different.
Using my google maps example, and iframe would should a little box on the page as you're use to it. A plain frame would take half the screen to display (you can set up many frames so that a particular frame is in the middle of the screen, but why do that when you can use an inline frame?)

Why are HTML frames bad?

Frames are more difficult to bookmark and, therefore, more difficult to share with others.

http://www.yourhtmlsource.com/frames/goodorbad.html

Are IFrames (HTML) obsolete?

In my opinion the W3C jumped the gun in dumping iframes from the Strict HTML and XHTML doctypes. In theory you would use the <object> element to add foreign objects to your document, but browser differences and limitations have made this a nonstarter for many developers. With the much-more-pragmatic HTML 5 (which is still a draft), iframes are back and even have two new attributes: seamless, and the intriguing sandbox.

Html5 frames alternative

You can use Iframes for this:

<iframe src="http://example.com/form.php" name="myform"> // or src="path/to/your/form.php"

// the content of your Iframe goes here...

</iframe>

http://www.quackit.com/html_5/tags/html_iframe_tag.cfm

http://webdesign.about.com/od/iframes/a/html5-iframe-attributes.htm

Frames in HTML5

You should definitely try not to use deprecated elements. They will behave inconsistently, and probably won't work in the future. There's also a very good reason why frames are deprecated.

You probably need to rethink how you're structuring your data. An HTML page should be as simple and to-the-point as possible. If you have to pull in a significant amount of content from other web-pages using frames, you're doing it wrong. In most cases it's better to simply link to the extra content.

If you're trying to use frames to pull in the <header> or the <nav>, so you don't have to simply copy them across multiple pages, although I applaud you for trying to be DRY, this is the wrong way to do it. Just copying these sections into all your documents is a better solution than using frames.

Ideally though, you'd use a server-side templating system of some sort. The simplest one (depending on your setup) may be Server-Side Includes.

Having said all that, if you really need frames, the <iframe> element is perfectly valid in HTML5 and may help you out.



Related Topics



Leave a reply



Submit