Ajax 与框架

发布于 2024-07-07 07:43:01 字数 61 浏览 5 评论 0原文

鉴于当今大多数网站实际使用 ajax 的方式; 为什么 ajax 受到欢迎,而框架仍然被认为是一个坏主意?

In light of how ajax is actually used by most sites today; why is ajax embraced while frames are still regarded as a bad idea?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

樱花坊 2024-07-14 07:43:01

从我现在的角度来看,AJAX 是一种重大的权衡。 您正在破坏互联网“文档”模型中的内容,以便您的网站可以表现得更像“应用程序”。 如果站点很好地使用了 AJAx,他们会以微妙的方式打破文档模型,从而为应用程序添加一些有价值的东西。 “投票”链接并不是真正的链接,但它为您提供了一个很酷的动画并异步更新问题的状态。

框架对文档模型(书签、滚动、复制粘贴等)的破坏同样多,甚至更多,但没有那么多好处。 框架还会插入我的操作系统/窗口管理器碰巧使用的任何装饰,因此它们看起来非常难看。

如果操作正确,AJAX 对于使用屏幕阅读器、基于文本的浏览器等的用户来说也会更好。

AJAX, from where I'm sitting, is a sort of grand tradeoff. You are breaking things in the "document" model of the interwebs so that your site can behave more like an "application." If a site is using AJAx well, they will break the document model in subtle ways that add something of value to the application. The "vote" link isn't really a link, but it gives you a cool animation and updates the question's status asynchronously.

Frames break just as much, if not more, of the document model (bookmarks, scrolling, copy-and-paste, etc) but without as much of the benefit. Frames also insert whatever decorations my OS/Window manager happens to be using, so they look pretty ugly.

AJAX, if done correctly, also breaks better for people using screen readers, text-based browsers, etc.

A君 2024-07-14 07:43:01

框架的大问题是,可以深层链接到框架集之外的框架页面,并且书签很少能按预期工作。 当然,所有这些问题都有修复方法,但它们只会让本来就不太好的系统变得更加笨重和复杂。

正如我在其他地方所说的,Ajax 更多的是关于将现代 javascript 引入主流并使其再次被接受,而不是使用 xmlhttp 对象(这正是术语 AJAX 的真正含义)。 一旦您拥有一个接受甚至期望使用 javascript 的网站,您就可以用它做很多更有趣的事情。

The big problems with frames are that it's possible to deep-link to the frames page outside of the frameset, and that bookmarking rarely works as expected. There are of course fixes for all these things, but they simply make an already not-very-nice system even clunkier and more complicated.

Ajax, as I have stated elsewhere, is more about bringing modern javascript to the mainstream and making it acceptable again than it is about using the xmlhttp object (which is really what the term AJAX means). Once you have a site on which javascript use is accepted and even expected, there's a lot more interesting stuff you can do with it.

魂牵梦绕锁你心扉 2024-07-14 07:43:01

使用 Ajax,您可以将所有逻辑放入 JavaScript 代码中。 这样您就可以创建或使用不依赖于您的页面的 JavaScript 库。 如果您使用 iframe,现在您必须处理隐藏控件,并且您的大部分 javascript 代码必须知道 iframe。

如果页面没有框架,搜索引擎也会更好地工作。

With Ajax you can put all your logic in javascript code. That way you can create or use a javascript library that does not depend on your page. if you use an iframe, now you have to deal with a hidden control and most of your javascript code has to know the iframe.

Also for search engines work better if the page don't have frames.

人生百味 2024-07-14 07:43:01

Ajax 为您提供更精细的控制。 您可以更新页面中的单个元素,其中框架使您可以控制甚至不在同一文档中的块。

Ajax gives you more granular control. You can update an individual element in a page, where Frames give you control of blocks that aren't even really in the same document.

陈独秀 2024-07-14 07:43:01

这里有两个简单的答案:

1) 仅仅使用术语 AJAX 就很酷,并且可以让您的项目听起来更像“Web 2.0”。 框架并不性感。 事实上,用网络术语来说,框架是性感的对立面。

2) 即使以非标准或缺乏支持的方式使用,AJAX 也是前瞻性的。 恕我直言,与向后看的框架相比,即使以相同的方式,中断前进的可能性也较小。

Here are two simple answers:

1) Just using the term AJAX is cool and makes your project sound more "Web 2.0". Frames is not sexy. In fact, in web terms, frames are the antithesis of sexy.

2) AJAX is forward looking even if used in non-standard or poorly supported ways. It is less likely, IMHO, to break moving forward compared to frames which is backward looking even if in the same manner.

趁微风不噪 2024-07-14 07:43:01

从可访问性的角度来看,Ajax 和框架完全不同(它们也完全不同)。
框架几乎没有什么积极作用,但却带来了许多负面问题。
另一方面,Ajax 使用户界面更加动态,并且在大多数情况下不会影响可用性。

Ajax and frames are completely different from an accessibility standpoint (they're also completely different full stop).
Frames offer very little positive effect but bring with them a host of negative issues.
Ajax on the other hand makes the user interface more dynamic without compromising usability in most cases.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文