Facebook, for example iframe, slows down page loading

I have a page on my website in which I added the Facebook function as a function implemented through a frame, as indicated in the Facebook specification.

The site is built in asp.net with the development of the client side through jquery.

Performance testing on the page showed that it now takes twice as much time to load than before, with the problem being Facebook submitting an iframe.

Therefore, you need to fix it. Any tips or suggestions? Can a possible job work without an iframe load?

+6
source share
3 answers

I found that this also applies to some of my sites. You can try using JavaScript to insert an iframe after the page loads.

+3
source

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

Wait for the onload event for the body, and then use the getElementById JavaScript method to get the iframe ID, and then enter this url as the src value.

+2
source

Since you added the jQuery tag, I assume that you have some JavaScript on the page that looks like this:

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

This ensures that your initialization code does not run until all page elements have been loaded. Unfortunately for you this includes an iframe. So, do as Alex says, and dynamically insert the iframe after loading the important bits.

+1
source

Source: https://habr.com/ru/post/887878/


All Articles