0
I have part of this code that belongs to an extension of Chrome. Clicking the share button does not share the content of the page I want.
Does anyone know how to share the page you are on at the moment of the click?
window.fbAsyncInit = function() {
FB.init({
appId : 'xxxx',
xfbml : true,
cookie : true, // enable cookies to allow the server to access the session
status : true, // check login status
version : 'v2.0'
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id))
//var e = document.createElement('script');
// e.src = document.location.protocol + 'all.js';
//e.async = true;
// document.getElementById('fb-root').appendChild(e);
return
js = d.createElement(s);
js.id = id;
js.src = "sdk.js";
js.async = true;
fjs.parentNode.insertBefore(js, fjs);
}
(document, 'script', 'facebook-jssdk'));
HTML:
<!doctype html>
<html>
<head>
<script src="fbbutton.js"></script>
<script src="settings.js"></script>
<style>
div span, iframe {
height:50px!important;
width:100px!important;
}
</style>
</head>
<body>
<div id="fb-root"></div>
<div style="width:160px; height:200px; font: normal 21px/23px 'ProximaNovaSemibold',Helvetica,Arial,sans-serif">
<form id="share" action="" method="">
<label>
<input type="checkbox" id="share2" name="share" /> <span style="position:relative; top:3px;margin-bottom:20px;c">Quer partilhar no face?</span>
</label>
<div class="fb-share-button" data-href="https://developers.facebook.com/docs/plugins/" data-layout="button" style="width:100px; height:50px;"></div>
</form>
</div>
</body>
</html>
Don’t use the snippet unnecessarily. Another thing you can read the documentation, because if for every detail of your application, you will create a question, which can be faster to learn, so at all times read the documentation and study for it! : ) Success
– Guilherme Nascimento