Facebook like iframe slowing down page loading
Asked Answered
R

3

6

I have a page on my website that I have added the Facebook like feature to it implemented via an frame as outlined in the Facebook specification.

The site is built in asp.net with client side development via jquery.

Performance tests on the page has shown it's now taking double the time to load than previously, with the issue being the introduction of Facebook iframe.

So need to fix this. Any tips or suggestions? Could a possible workatoubdcbe the loading of the iframe ayschraneously?

Roundshouldered answered 12/5, 2011 at 0:46 Comment(0)
A
3

I've found this to be the case too with some of my sites. You could try using JavaScript to insert the iframe once the page has loaded.

Adrien answered 12/5, 2011 at 0:51 Comment(0)
O
2

You can give the iframe an id and leave it empty in the src .

Wait for the body onload event and then use the "getElementById" JavaScript method to get the ID of the iframe and then input that url as the src value.

Oil answered 12/5, 2011 at 1:3 Comment(0)
T
1

Since you added the JQuery tag, I'm guessing that you have a bit of JavaScript on the page that looks like this:

$(document).ready(function() {
    // initialize everything here

This makes sure that your initialization code won't run until all the page elements are loaded. Unfortunately for you, this includes the iframe. So, do like Alex says and insert the iframe dynamically after the important bits are loaded.

Twofaced answered 12/5, 2011 at 0:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.