Why are frames deprecated in html?

2019-01-03 16:00发布

HTML has had frames from early days, but they are deprecated in the latest version. Many browsers (I have tried with Internet Explorer) don't even display frames properly.

Why has this been done? What was the drawback in frames?

标签: html frames
3条回答
趁早两清
2楼-- · 2019-01-03 16:04

Not to answer the OP but rather balance the bashing of framesets.

I find them great and nothing comes close to them when you want your menu intact and still:

  • Visually incorporate 3-rd party pages/apps (phpmyadmin or similar)
  • Viewing doctypes other than html (pdf's or images).
  • Due to its width="x,*" you get a simple "responsive" behaviour.

Also, you can provide smooth menu-animations while fetching main contents.

Used with sense, they're super.

查看更多
来,给爷笑一个
3楼-- · 2019-01-03 16:05

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.)

查看更多
Lonely孤独者°
4楼-- · 2019-01-03 16:25

Frames are not deprecated in HTML. They are obsolete in HTML 5, and just discouraged before this version. This has been clearly mentioned in the specified links.

查看更多
登录 后发表回答