I was setting up a Facebook Page for a client and noticed that it was taking forever to load the IFrame I had pointing it to. When I visited the IFrame contents without going through Facebook it was really fast, but when through Facebook it took up to 5 seconds before it even started loading the IFrame contents.
I was going to try different apps other than the “Static HTML: IFrame Tabs” but everyone claims that this is the best app for loading an iframe into your facebook page. I accepted this, and decided that perhaps if I couldn’t improvement the performance of it, I could at least let our visitors know that something was loading and to please be patient. I feared that the blank page while it was loading would make users think it was broken.
Here’s the code I came up with:
<img src="https://www.yourserver.com/loading.gif"
width=508 height=381 id='loadingimg'>
<iframe src="https://www.yourserver.com/iframe.php"
frameborder="0" width="520" height="2500" scrolling="no"
id="theiframe" style="visibility:hidden"
onload="document.getElementById('loadingimg').style.display='none';
document.getElementById('theiframe').style.visibility='visible';"></iframe>
Just place this in the setup of your Static HTML contents and it will show a loading image (you’ll have to change the path to an image of your own) while it’s loading the IFrame (also don’t forget to put in the path of your iframe instead).
Hope that helps!
Leave a Reply to Dana Cancel reply