Html IFrame 和 Frame 有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1079128/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 00:06:53  来源:igfitidea点击:

What's the difference between IFrame and Frame?

htmliframeframe

提问by Duncan

Looking at options for embedding the 3D Secure page inside my own order form, I came across the following:

查看在我自己的订单中嵌入 3D Secure 页面的选项,我遇到了以下问题:

"Some commerce sites will devote the full browser page to the authentication rather than using a frame (not necessarily an iFrame, which is a less secure object anyway)."

“一些商业网站会将完整的浏览器页面用于身份验证,而不是使用框架(不一定是 iFrame,反正它是一个不太安全的对象)。”

from http://en.wikipedia.org/wiki/3-D_Secure

来自http://en.wikipedia.org/wiki/3-D_Secure

Can someone give me the lowdown as to whyiframes are less secure, and cause problems, as opposed to normal frames? And what are the basic differences?

有人可以告诉我为什么iframe 与普通框架相比不那么安全并导致问题吗?基本的区别是什么?

The way I see it, iframeis the way to go.

我看到iframe的方式,就是要走的路。

采纳答案by rahul

The difference is an iframe is able to "float" within content in a page, that is you can create an html page and position an iframe within it. This allows you to have a page and place another document directly in it. A framesetallows you to split the screen into different pages (horizontally and vertically) and display different documents in each part.

不同之处在于 iframe 能够在页面的内容中“浮动”,也就是说,您可以创建一个 html 页面并在其中放置一个 iframe。这允许您拥有一个页面并直接在其中放置另一个文档。Aframeset允许您将屏幕分成不同的页面(水平和垂直)并在每个部分显示不同的文档。

Read IFrames security summary.

阅读IFrames 安全摘要

回答by Dan Herbert

IFrame is just an "internal frame". The reason why it can be considered less secure (than not using any kind of frame at all) is because you can include content that does not originate from your domain.

IFrame 只是一个“内部框架”。之所以认为它不太安全(比根本不使用任何类型的框架)是因为您可以包含并非源自您的域的内容。

All this means is that you should trust whatever you include in an iFrame or a regular frame.

所有这一切意味着您应该信任 iFrame 或常规框架中包含的任何内容。

Frames and IFrames are equally secure (and insecure if you include content from an untrusted source).

Frames 和 IFrames 同样安全(如果包含来自不受信任来源的内容,则不安全)。

回答by Ivo

iframes are used a lot to include complete pages. When those pages are hosted on another domain you get problems with cross side scripting and stuff. There are ways to fix this.

iframes 经常用于包含完整的页面。当这些页面托管在另一个域上时,您会遇到跨端脚本和其他内容的问题。有办法解决这个问题。

Frames were used to divide your page into multiple parts (for example, a navigation menu on the left). Using them is no longer recommended.

框架用于将您的页面分成多个部分(例如,左侧的导航菜单)。不再推荐使用它们。

回答by James

The only reasons I can think of are actually in the wiki article you referencedto mention a couple...

我能想到的唯一原因实际上是在您引用维基文章中提到了几个......

"The "Verified by Visa" system has drawn some criticism, since it is hard for users to differentiate between the legitimate Verified by Visa pop-up window or inline frame, and a fraudulent phishing site."

"as of 2008, most web browsers do not provide a simple way to check the security certificate for the contents of an iframe"

““Visa 验证”系统引起了一些批评,因为用户很难区分合法的“Visa 验证”弹出窗口或内嵌框架与欺诈性网络钓鱼站点。”

“截至 2008 年,大多数网络浏览器都没有提供一种简单的方法来检查 iframe 内容的安全证书”

If you read the Criticismsectionin the article it details all the potential security flaws.

如果您阅读文章中的批评部分,它会详细介绍所有潜在的安全漏洞。

Otherwise the only difference is the fact that an IFrameis an inline frame and a Frameis part of a Frameset. Which means more layout problems than anything else!

否则唯一的区别是IFrame是内联框架,而FrameFrameset 的一部分。这意味着布局问题比什么都多!

回答by khan iffat

Inline frame is just one "box" and you can place it anywhere on your site. Frames are a bunch of 'boxes' put together to make one site with many pages.

内嵌框架只是一个“盒子”,您可以将其放置在站点的任何位置。框架是一堆“盒子”放在一起,使一个网站有很多页面。

回答by user1213898

While the security is the same, it may be easier for fraudulent applications to dupe users using an iframe since they have more flexibility regarding where the frame is placed.

虽然安全性是相同的,但欺诈应用程序可能更容易欺骗用户使用 iframe,因为它们在放置框架的位置方面具有更大的灵活性。