By Espen on Saturday, 29 April 2017
Posted in Technical Issues
Likes 0
Views 340
Votes 0
Hi.

I have been in contact with Sourcecoast regarding this issue to. Their Javascript is loaded in the AMP pages. Is is possible to block this javascript in EB? It seems like you are blocking other JS, but this one is loading. I will also ask Sourcecost to investigate this further.


<script type="text/javascript">

window.fbAsyncInit = function() {
FB.init({version: 'v2.3',appId: '1443954035921875', status: false, cookie: true, xfbml: false});
FB.Event.subscribe('comment.create', jfbc.social.facebook.comment.create);
FB.Event.subscribe('comment.remove', jfbc.social.facebook.comment.remove);
FB.Event.subscribe('edge.create', jfbc.social.facebook.like.create);
FB.Event.subscribe('edge.remove', jfbc.social.facebook.like.remove);
};
(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/nb_NO/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
Most plugins should actually not render anything if the document isn't html. I believe a simple checking like this should solve most of the issues,

[gist]
<?php if (JFactory::getDocument()->getType() != 'html') { return; } ?>
[/gist]
·
Sunday, 30 April 2017 00:21
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Mark! I added the check to the plugin, and it seems to work. I´ll ask the Sourcecost team to add the check to the JFBC plugin so other avoids error on their AMP pages if the are using Sourcecoast.
·
Sunday, 30 April 2017 02:10
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

You are most welcome. Glad to hear that your issue has been resolved now.

As a gentle reminder, kindly start a new thread if you have any other issue in the future so it will be easier for us to manage your inquiry. I will lock and mark this thread as resolved.
·
Sunday, 30 April 2017 12:31
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post