开发者

Why are frames deprecated in html?

开发者 https://www.devze.com 2023-01-26 09:44 出处:网络
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.

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 fram开发者_开发知识库es?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消