amateur
amateur

Reputation: 44605

Facebook like iframe slowing down page loading

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?

Upvotes: 6

Views: 1383

Answers (3)

alex
alex

Reputation: 490233

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.

Upvotes: 3

Chris_O
Chris_O

Reputation: 3444

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.

Upvotes: 2

Mike Baranczak
Mike Baranczak

Reputation: 8374

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.

Upvotes: 1

Related Questions