开发者

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?


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜