Topic-icon How I can load the script (eg: sdk.js for Facebook) by +special tag

Active Subscriptions:

None
Hi Team,

I would like to know how I can load those social scripts (eg: connect.facebook.net/zh_TW/sdk.js) by adding below special tag maybe via code modification?
<script data-cfasync="true" src="/javascript.js"></script>

I need to add this to instruct the RocketLoader (from Cloudflare.com) to turn on the asynchronous JavaScript loader for specific scripts;

Reference1 : support.cloudflare.com/hc/en-us/articles/200168056
Regerence2: support.cloudflare.com/hc/en-us/articles...s-in-Automatic-Mode-

Some of my customers FROM CHINA reported that they were unable to load our website within the China Region (China blocks all facebook.com , google.com, etc.)...after our checking, some social scripts are totally blocked and the browser will wait for the blocked script to load until timeout (1 min+). I found turning on the Cloudflare's RocketLoader will resolve the problem (the browser won't wait for the blocked scripts); however, I cannot turn on this for all scripts or some other scripts will not work probably.

I need some guideline from your team for us to add data-cfasync="true" to instruct the Rocketloader to load some specific scripts asynchronously. (eg: let us know where to change the code).

Thanks ahead!

Best regards,
Alfred
The topic has been locked.
Support Specialist
Alfred,
JFBConnect already uses an asynchronous loading method for the Facebook Javascript library. It shouldn't block your page from loading when not present.

As for the RocketScript stuff, I'm honestly not sure how to add the tag you're looking for to the Javascript call. The place we load the library is in the /components/com_jfbconnect/libraries/provider/facebook.php file. Look around line 429, and you'll see:
<<<EOT
<div id="fb-root"></div>
<script type="text/javascript">
    {$canvasCode}\n
    window.fbAsyncInit = function() {
    FB.init({{$version}{$appIdCode}{$status} cookie: true, xfbml: {$xfbml}});{$subs}{$resizeCode}
    };
     (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "//connect.facebook.net/{$locale}/{$script}";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
    </script>
EOT;
The code comes from Facebook's own recommendations for asynchronous inclusion, which can be found here .

I hope that helps get you started,
Alex
The topic has been locked.