Проблем с Google Page Speed и Facebook "Enable compression"

Проблем с Google Page Speed и Facebook "Enable compression"

Гугъл казва, че трябва да се оптимизират скриптовете от facebook. Супер, но ние нямаме достъп до тях. Ето го и съобщението:

Enable compression
Compressing resources with gzip or deflate can reduce the number of bytes sent over the network.
Enable compression for the following resources to reduce their transfer size by 447KiB (72% reduction).

    Compressing https://static.xx.fbcdn.net/rsrc.php/v2/yn/r/TafFivy4OjC.js could save 132.2KiB (72% reduction).
    Compressing https://static.xx.fbcdn.net/rsrc.php/v2/y0/r/89exU7sq7Ld.css could save 83.2KiB (81% reduction).
    Compressing https://static.xx.fbcdn.net/rsrc.php/v2/y6/r/9tEPef2Xf70.js could save 81.6KiB (72% reduction).
    Compressing https://static.xx.fbcdn.net/rsrc.php/v2/yh/r/Sst4Eu6wCBO.js could save 69.3KiB (70% reduction).
    Compressing https://static.xx.fbcdn.net/rsrc.php/v2/yq/r/EKSe2LvV9st.css could save 29.5KiB (81% reduction).
    Compressing https://static.xx.fbcdn.net/rsrc.php/v2/yg/r/QHf4dqPAsjn.js could save 19.7KiB (68% reduction).
    Compressing http://dobrich24.com/fonts/tiefontello.svg?88026028 could save 15.3KiB (56% reduction).
    Compressing https://static.xx.fbcdn.net/rsrc.php/v2/yG/r/ZvGCpbKPoq8.js could save 11.9KiB (62% reduction).
    Compressing https://static.xx.fbcdn.net/rsrc.php/v2/y2/r/HOF18dCoWFZ.css could save 2.6KiB (67% reduction).
    Compressing https://static.xx.fbcdn.net/rsrc.php/v2/yy/r/Aqy-PT2Uo_S.js could save 1.8KiB (53% reduction).

Решение: Използване на lazyscript -- http://hayageek.com/jquery-lazy-loading-scripts ;)

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://hayageek.com/examples/jquery/lazy-script/jquery.lazyscript.js" type="text/javascript"></script>

<script>
$(document).ready(function () {
var options = {
type: "delay",
time:1000,
scripts: [
"http://platform.twitter.com/widgets.js",
"http://connect.facebook.net/en_US/all.js#xfbml=1&appId=445577382175430",
"https://apis.google.com/js/plusone.js"
],
success: function () {
FB.init({ status: true, cookie: true, xfbml: true });
}
};
$.lazyscript(options);

});
</script>



<div class="fb-like-box" data-href="http://www.facebook.com/FACEBOOKPAGE" data-width="180" data-show-faces="true" data-stream="false" data-header="false"></div>
VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
Проблем с Google Page Speed и Facebook "Enable compression", 5.0 out of 5 based on 1 rating

Вашият коментар

Вашият email адрес няма да бъде публикуван Задължителните полета са отбелязани с *