Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 30 of 30
  1. #16
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    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.
    Last edited by itsallkizza; 12-05-2008 at 05:36 PM.
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com

  2. #17
    New to the CF scene
    Join Date
    Mar 2006
    Location
    Mid-Missouri, USA
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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:

    Right after the <body> tag:
    Code:
    <iframe id="channel_iframe"></iframe>
    And the loader:
    Code:
    onloadRegister(function() {channelManager.iframeLoad("\/iframe\/10?r=http%3A%2F%2Fstatic.ak.fbcdn.net%2Frsrc.php%2Fz2F1W%2Flpkg%2Fb5q02ww8%2Fen_US%2F141%2F134751%2Fjs%2F97qxpm42mnksoos8.pkg.js&r=http%3A%2F%2Fstatic.ak.fbcdn.net%2Frsrc.php%2FzB82G%2Fl%2F2937wik3%2Fnu_ll%2F134020%2Fjs%2Fpresence%2Fiframex.js", "channel05", 80, 1);});

  3. #18
    hjb
    hjb is offline
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post
    Ok, a possible solution to your problem....

    1) add an onclick event to all <a> tags for which you want to spoof page load. something like:

    Code:
    <a href="/real_url/page.html" onclick="spoofPageLoad(this);">link text</a>
    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


    .

  4. #19
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  5. #20
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hjb, when I try your code out, the javascript function spoofPageLoad, the link.url says undefined. This is in FireFox.

  6. #21
    hjb
    hjb is offline
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by theor74 View Post
    hjb, when I try your code out, the javascript function spoofPageLoad, the link.url says undefined. This is in FireFox.
    I know. The code doesn't work. I stated that above.

    However....

    replace link.url

    with link.href

    and retry. The rest is up to you.

  7. #22
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  8. #23
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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)

  9. #24
    hjb
    hjb is offline
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post
    Hi Sumez,

    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.

  10. Users who have thanked hjb for this post:

    chaoticlife (04-16-2009)

  11. #25
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  12. #26
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    Using iframes is AJAX. If you want to separate XMLHTTPRequests from Iframe usage or other methods of AJAX, be specific.
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com

  13. #27
    hjb
    hjb is offline
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post
    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.

  14. #28
    Regular Coder
    Join Date
    Jul 2006
    Posts
    399
    Thanks
    33
    Thanked 7 Times in 7 Posts
    must be an ajax request called thru php get superglobal

  15. #29
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks for the clear explanation, hjb.

  16. #30
    SJF
    SJF is offline
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    An interesting note.

    First and foremost, sorry for the bump - but this is an interesting addition to this discovery of the way Facebook changes pages.

    Code:
    javascript:(function(){var%20i=0,r=function(n){return%20Math.floor(Math.random()*n)},f=document.getElementsByTagName('body')[0].getElementsByTagName('*'),o=function(e){return%20typeof(e.style)=='object'&&e.tagName!='SCRIPT'},s=function(){while(!o(e=f[r(f.length)])){}return%20e.style};while(i++<5){s().display=r(2)?'block':'inline';s().position=r(2)?'absolute':'relative';s().margin=r(2)?'0':'1em';s().padding=r(2)?'0':'1em';s().width=r(2)?'':'auto';}})();
    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.

    With that said, happy coding!


 
Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •