Welcome to Geeklog, Anonymous Monday, September 16 2024 @ 08:55 pm EDT
Geeklog Forums
{return
Status: Banned
gtgillis
Forum User
Full Member
Registered: 11/05/03
Posts: 121
I am playing with Facebook comments to see how difficult it would be to create a plugin or add the functuionality to the SocialShare plugin. While testing I inserted a <div> and a portion of script into the header.thtml file and a <div> into the storytext.thtml file. When I view the page source I see that part of the script from the header.thtml file has been stripped out.
This is the code I inserted into the header.thtml file.
<div id="fb-root"></div>
<script>(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/en_US/all.js#xfbml=1&appId=MY_FB_APP_ID";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
This is what I see when I view the source. As you can see it is missing the "{return;}" on the line four.
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id))
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=MY_FB_APP_ID";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
I guess I need to know how and why it is being stripped out and how I can work around it.
Regards,
Greg
This is the code I inserted into the header.thtml file.
Text Formatted Code
<div id="fb-root"></div>
<script>(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/en_US/all.js#xfbml=1&appId=MY_FB_APP_ID";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
This is what I see when I view the source. As you can see it is missing the "{return;}" on the line four.
Text Formatted Code
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id))
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=MY_FB_APP_ID";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
I guess I need to know how and why it is being stripped out and how I can work around it.
Regards,
Greg
19
12
Quote
All times are EDT. The time is now 08:55 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content