MyBB Internal: One or more warnings occured. Please contact your administrator for assistance.
WebPagetest Forums - Facebook SPOF - how to prevent?

WebPagetest Forums

Full Version: Facebook SPOF - how to prevent?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Facebook was/is down for > last 1 hour... it caused problems for my site

http://www.webpagetest.org/result/100923...835ed4161/

I use iframe for the like/recommend widget. On my site, the story pages are cached on disk for months, so for now i replaced the facebook url with a dummy blank html page (using substitute module in nginx) to mitigate the SPOF until Facebook fixes their shit.

The question is... how to prevent this in the future? Any hacks around where i can load iframes in a manner such that their failure doesnt hold back the document.onload() from firing?

PS: PLS don't suggest getting rid of the Facebook widget . it gets me traffic Smile
Can you populate the Facebook widget at onload? That would certainly do it (though it would delay rendering of the widget) :-)
(09-24-2010 07:29 AM)pmeenan Wrote: [ -> ]Can you populate the Facebook widget at onload? That would certainly do it (though it would delay rendering of the widget) :-)

aha... thanks... makes sense.... i don't mind the 3 - 5 second delay in the facebook widget being populated (i think - would be worth doing ab testing on it)...

meaning something like this?

Code:
<div id="facebookwidget"></div>

and after onload

Code:
document.getElementById('facebookwidget').innerHTML = '<iframe src......>';

or is there a better way?

on a side note... facebook should use a cdn served static file for the base iframe page... and then the iframe should load the dynamic stuff via ajax call.
That would probably work but might be cleaner to include the empty iFrame and then just set the src as part of the onload: http://www.cryer.co.uk/resources/javascr...singIFRAME
Realized this issue is bigger than i suspected
see http://www.webpagetest.org/result/100923...1/details/

I have the tweet button on all my pages also (loading them async but not deferring them) . Since china blocks twitter, so all pages which uses the tweet button(or facebook like widget) will fail. Even worse consequences if they load it synchronously as the docs suggest.

Deferring 3rd party stuff is a workaround, but not a nice one.. In some cases the user may already finish "scanning" the story before the sharing widgets come to life...

China is not a major target for me, but each click counts. Moreover, if universities/corporate networks blocks these sites, our pages would also suffer similarly... Need to find some better solution to these issues than deferring their loading...

Sidenote: TribalFusion ad network also seems to be blocked in China...
I guess it largely depends on what your page does. If you don't have any code attached to onLoad then loading the widgets asynchronously is probably the best way to do it because they will load quickly in the normal case and not block any of your actual page functionality (though the user will see the page "loading" until everything fails).

If you do have logic you care about attached to onload then things get trickier because these failures actually push that out and you have a SPOF again (just not for the page content). Would be great if there was a way to async load during the page load and make that content not block the onload but I'm not aware of any reliable ways to do it.

I hadn't thought about the pathological case of things being broken because of the great firewall but that could actually be a pretty big deal for a lot of the web.
Ok... found a solution for iframes

http://stevesouders.com/efws/iframe-onlo...ocking.php

Does not need to be differed to after onload.
Does not block onload event
Reference URL's