The bottom bar IS refreshing (and being rebuilt by code on refresh) whenever the user goes to a new page.
For example, if I were to click on an app (like MobWars) from my main profile page, the page would refresh and the bottom toolbar would appear to remain the same, but in fact it also would be refreshed.
__________________
Feel free to e-mail me if I forget to respond ;) ohsosexybrit@gmail.com
Last edited by itsallkizza; 12-05-2008 at 05:36 PM..
How about we contact a lead Facebook developer to take part in this conversation?
Or, alternatively, someone could easily disassemble the Facebook and have proof of what is really going on.
I would enter my opinion, but at this time I doubt it really matters.
The person who started the thread asked a question. I think the only suitable thing to respond with is a plausible answer. So animedude123, you have a few options to accomplish this; read the above posts for reference to these ideas, and try to ignore the silly fights that occurred intermittently.
Personally, I would like to think this is sufficient proof to backup hjb's theory:
2) create the javascript function spoofPageLoad. something like
Code:
function spoofPageLoad(link)
{
// get the url to spoof
var url = link.url;
// create an iframe element
var iframe = document.createElement('IFRAME');
// create a unique id for the iframe
var id = (new Date).getTime();
// set the id to the iframe
iframe.id = id;
// add the iframe to the body
document.body.appendChild(iframe)
// set the url of the iframe
iframe.src = 'http://example.com/getPageContent.php?id='+id+'&url='+url;
// cancel default link click
return false;
}
3) Create the backend php to send the right page back
Code:
<?php
if($_GET['id'] && $_GET['url'])
{
// load the page content with a FAKE FUNCTION THAT NEEDS CREATING
$html = addslashes(loadPageHtml($_GET['url']));
// output a page that will fire the update page function in the parent frame
?>
<html>
<head>
<script type="text/javascript">
function fireUpdate()
{
window.top.window.updateContent("<?php print $_GET['url']; ?>", "<?php print $html; ?>", <?php print $_GET['id']; ?>);
}
</script>
</head>
<body onload="fireUpdate();"></body>
</html>
<?php
}
?>
4) create the javascript updateContent function
Code:
function updateContent(url, html, id)
{
// get the content div
var content = document.getElementById('content');
// set innerHTML (update the page)
content.innerHTML = html;
// update the hash part of the url for browser history and possible bookmarking
window.location.hash = url;
// get reference to the iframe
var iframe = document.getElementById(id);
// set a timeout to then remove the iframe - we do this because IE has issues with iframes still loading after remove
setTimeout(function()
{
document.body.removeChild(iframe);
},200);
return false;
}
*NOTE* - I haven't tested any of the above code and I know there are issues:
* You need to write a php function to get the actual page html from database or file
* You need to write code to catch a user returning with a page address in the hash part of the url (ala Facebook) - true bookmarking with hash
All other parts of the page (including footer) will be untouched
I just want to confirm that the Facebook bar doesn't reload on page change.
If you want to test by yourself, install Firefox 3 and Firebug extension (www.getfirebug.com).
Once on a Facebook page, modify the HTML of an item of the bar* and change page ... the change is still there. This kind of change made by the user, change Facebook is not aware of, can't be transported on an new page.
* For example, in the console tab, type :
document.getElementById('presence_applications_tab').style.backgroundColor='red';
That line will change the bakcgound color of the "Application" button to red.
Also if you go to the HTML tab and unfold "body" and change page, you will see an iframe briefly appearing at the bottom of the tree.
Firefox and MSIE both behave similarly in that they do -not- reload the page on navigation.
Chrome, Safari and Opera on the other hand reload the page.
I just wanted to point this out as it doesn't seem like anyone has mentioned it yet.
A side note, it's interesting and puzzling that Facebook would only implement this in two browsers and not in the others. Perhaps there are cross domain JavaScript issues we do not know about?
Edit: "cross domain JS" referring to the iframe solution
Yeah, I was wondering why they load the page into an iFrame, instead of "just" using AJAX? It doesn't seem like the best solution to me, but there must be a reason for it. Any theories?
After all, Facebook are the biggest AJAX whores you can find. :P (but so am I, I love the possibilities it gives you)
pretty sure that Facebook have chosen iframes over ajax because web sites that use AJAX won't work on IE when ActiveX controls are disabled in the security settings.
I really don't know how I ended up with negative reputation for this thread!? Personally I thought I had been accurate, objective and helpful.
Definitely, the information you provided here has definitely been very useful. And correct, unlike a lot of other claims in this thread.
So does that mean Facebook NEVER uses AJAX? For the smaller functions as well, such as the "Like" buttons?
That's a surprise to me, I was convinced it was practically made up of AJAX - but I guess the end result is the same.
itsallkizza is correct. Ajax also includes iframe requests however, I know what you meant.
Facebook uses iframe and XMLHTTPRequests all over the place and all the time. If you install 'firebug' for firefox and click the console tab you can see all the requests flying.
I can only think they use XMLHTTPRequests for things that are 'nice have' items but not required for functionality, where they use iframes. For example, XMLHTTPRequests is used for chat, notifications and inbox updates, on page status updated.
That code is from IE6ify, a funny little joke for designers that if you put that code into a bookmark on your bookmark toolbar and keep clicking it, it randomly screws up your page.
Now why is this relevant?
I was on this thread a couple days ago, wondering exactly how Facebook DOES change its pages. And after sifting through the very caddy immature responses, and hallow threats to report to a MOD (for no reason) ... I discovered there was a misconception. On one end, people were claiming that it is impossible, that the bottom bar refreshes, as does the whole page. On the other end, (the right end), people were saying no it doesn't, it uses an iframe to bring in the content, etc, notice the hash in the address bar.
With the IE6ify script I included above, you can CLEARLY SEE it does NOT refresh the page. In fact, even in Safari it does not refresh it. YES, I know, it does in Chrome & IE, but those are irrelevant to this case because it does NOT in Firefox and Safari, making the question remain, how DO they do it? I think hjb provided a very good amount of information toward this, and want to comment quickly on that.
First let me preface what I'm about to say with IDGAF about my 'rep' or 'my post being removed' with this... but I think it's absolute BULL that there is SO MUCH immaturity on forums these days. We should all be here to help each other out. That's it. I absolutely HATE when people state "facts" and shut out any other suggestion from anyone else. Its absolutely ridiculous.