social media share specific content out of page - facebook

I am having some issue with my social media share code.
See my code below:
// I want to share this div (id="maindiv") at facebook on click of facebook share button...
<html>
<head>
</head>
<body>
<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/sdk.js#xfbml=1&version=v2.5&appId=17968886776";
fjs.parentNode.insertBefore(js, fjs);
}
(document, 'script', 'facebook-jssdk'));
</script>
<div id="maindiv1" style="border:1px solid blue;width:500px;height:230px">
<div style="border:0px solid red;width:100px;height:80px;float:left;">
<img src="http://localhost:8080/pushnotification/img/small-icon.png" /><img>
</div>
<h1 style="color:blue;font-family:sans-serif;float:left;width:390px;margin-top:10;text-align:center;border:0px solid red;">enterployee.com</h1>
<div style="border:0px solid red;width:100%;height:120px;float:left;">
<p style="font-family:sans-serif;font-size:15px;">
Enterployee.com is a employee relationship management tool for enterprise. It’s a fully managed notification platform for employees.
We have a vision to make organizations more professional and organized. After getting an enterployee account organizations can notify their employees easily and employees can connect with their company in better way.
</p>
</div>
<div style="border:0px solid red;width:80px;height:30px;float:right;">
<div class="fb-share-button" data-href="http://localhost:8080/pushnotification/img/small-icon.png" data-layout="button"></div>
</div>
</div>
</body>
So the problem is that I have multiple jobs posting in my site and I need to add this share button to each individual divs, not the full page. I have done the coding for full page share but need help in sharing only some part of page or a div.

<div class="fb-share-button" data-href="y" data-layout="our urlherebutton"></div>
(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/sdk.js#xfbml=1&version=v2.5";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

Related

Adding a facebook like button to a website

I want to add a like button to my website but I'm having trouble doing so.
After some research I found this code that has to be right after the opening body tag:
<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_GB/sdk.js#xfbml=1&version=v2.9";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
and with it comes this code that goes where I want my like button in the page:
<div class="fb-like"
data-href="http://www.facebook.com/curlybracketssarl"
data-width="200" data-layout="standard" data-action="like"
data-size="small" data-show-faces="true" data-share="false"></div>
Yet nothing is showing, I even tried to do so in a blank page and got no results once again.
So can you kindly tell me how to do what I need to do?

Facebook Share Button on mobile view

Conquistadores!
I implemented an facebook share button, that works absolutely fine except in mobile view. Have a look: http://parkfreunde-weissensee.berlin/2017/07/04/jetzt-handeln-die-gelegenheit-war-nie-so-guenstig
Looks like the URL will not be transfered on smartphones. Any idea where I have to trim the 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/de_DE/sdk.js#xfbml=1&version=v2.8&appId=123456789";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
And the Button
<div class="facebook-share__article-footer__container">
<div class="facebook-share__article-footer">
<?php
// $title=urlencode('');
$url=urlencode(get_permalink($post->ID));
// $summary=urlencode('');
// $image=urlencode('');
?>
<a onClick="window.open('http://www.facebook.com/sharer.php?s=100&p[title]=<?php echo $title;?>&p[summary]=<?php echo $summary;?>&p[url]=<?php echo $url; ?>&&p[images][0]=<?php echo $image;?>', 'sharer', 'toolbar=0,status=0,width=548,height=325');" target="_parent" href="javascript: void(0)" class="single-post__social-media-button-invert">Auf Facebook teilen</a>
</div>
</div>
Best regards from Berlin
Tibor

How to add on website facebook like box with comment box together?

Here is code for like box we need to add comment box and like box in each post...
<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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like-box" data-href="http://www.facebook.com/OneLife4Live" data-width="600" data-height="400" data-colorscheme="light" data-show-faces="false" data-header="flase" data-stream="true" data-show-border="true">
</div>
you keep logged in facebook on another tab.
you will get Likebox and commentbox directly when you facebook logged in browser.

facebook like button red error

I embed Facebook like button in my page, but the problem is that, when I login using the like button then the page is liked. But if I already logged in from another page or tab and I clicked the like button a red error is displayed and a message pops up that the message has been blocked by our security system.
My code to embed like button:
<html xmlns:fb="http://ogp.me/ns/fb#">
<head>
<title>Facebook Checker</title>
<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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
</head>
<body >
<div id="fb-root"></div>
<div class="fb-like" data-href="http://www.google.com" data-width="450" data-layout="button_count" data-show-faces="false" data-send="false"></div>
<script type="text/javascript">
</script>
</body>
</html>
Facebook Like detect suspecious Activity on Localhost. Make a forward account and forward your localy site and past the above code its Works Fine :)
<html xmlns:fb="http://ogp.me/ns/fb#">
<head>
<title>Facebook Checker</title>
<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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
</head>
<body >
<div id="fb-root"></div>
<div class="fb-like" data-href="http://www.google.com" data-width="450" data-layout="button_count" data-show-faces="false" data-send="false"></div>
<script type="text/javascript">
</script>
</body>
</html>

Facebook Like-Box only displays in Safari

I currently have a Like-Box that is only visible while I'm in Safari on my MacBook.
The following are unable to view the like-box (that I have tested so far):
Chrome,Safari (mobile) (iPhone4,4S,5,iPad), Firefox
Is functionality restricted to a certain Java setup? I pulled the code directly from Facebook and have included the Java as they recommend.
Thanks in advance!
Code in question:
Facebook-supplied block:
<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=MYAPPID";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
LikeBox:
<div class="fb-like" data-href="https://www.facebook.com/pages/MyPage/MyID" data- send="false" data-width="60" data-show-faces="true"></div>
</div>
Please Note that I have deidentified my Page and ID, thanks.