Facebook的页脚酒吧是一个iframe,那么为什么不将其与页面的其余部分重装?是一个、将其、重装、酒吧

2023-09-11 22:31:42 作者:忘记伱,谈何容易。

我想知道的Facebook是如何做的 IFRAME 页脚栏。我的意思是,我知道他们对页脚的iframe,但我想知道他们是如何重新加载页面无需重新加载的iframe也,导致 IFRAME 始终坚持走有,即使该页面不重新载入。任何想法/知识?

I want to know how Facebook is doing their iframe footer bar. I mean, i know they have an iframe on footer, but i want to know how they are reloading pages without reloading the iframe also, 'cause the iframe always stick there even though the page does reload again. Any ideas/knowledge?

编辑:

试着点击一个链接是不同的部分,它的URL改变了,到目前为止,我知道,如果你试图更改URL,那么该网页将重新载入。此外,尝试使用Facebook的在Chrome:你会看到它重新加载每一个新的页面上。这不是AJAX,因为如果它是AJAX(做一点研究的URL变化,你就会知道)的网址不会改变。

Try clicking on a link which is different section and it changes the url and so far i know, if you try to change the URL, then the page will reload again. Also, try using Facebook on Chrome: you will see it reloads on every new page. It's not AJAX, because the URL wouldn't change if it was AJAX (do little research on URL changing, you will know).

推荐答案

好了, powtac pretty的多给你答案:Facebook并没有重新加载整个页面,当你点击一个链接,它要求通过XMLHtt prequest新的内容,并刷新了改变网页的那些部分。

Well, powtac pretty much gave you the answer: Facebook doesn't reload the whole page when you click a link, it requests the new content via XMLHttpRequest and refreshes only those portions of the page that change.

这是关于这个pretty的滑头:一个幼稚的做法是不要使用真正的链接可言,因此$ P $从开放pventing你,比如说,在一个单独的浏览器选项卡不同的Facebook标签。

It's pretty slick about this: a naive implementation might not use real links at all, thus preventing you from opening, say, a different Facebook tab in a separate browser tab.

此技术 - 拦截的链接导航 - 还允许Facebook的使用custom提示当您尝试导航离开而不保存,并重新写为片段的路径,允许它无需刷新页面,以跟踪URL的当前位置。

This technique - intercepting link navigation - also allows Facebook to use custom prompts when you try to navigate away without saving, and re-write paths as fragments, allowing it to track the current location in the URL without reloading the page.

FWIW,这个问题已经被问和回答 - 看:如何Facebook的聊天窗口实现的?

FWIW, this question has already been asked and answered - see: How are the facebook chat windows implemented?