Hi i tried to display a alert message after user click follow
Follow #twitterapi
<script type="text/javascript">
!function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = "//platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
}
}(document, "script", "twitter-wjs");</script>
<script type="text/javascipt">
twttr.events.bind('follow', function (event) {
alert("message");
});
</script>
I didn't get the alert message.Am i doing correctly?
Can anyone help? Thanq
Related
I have included the code i needed to be able to show the facebook login button on my page. But the button does not show up, could you please read my code and tell me if you see any problems with it? Thank you
<!DOCTYPE html>
<html>
<body>
<script>
window.fbAsyncInit = function() {
FB.init({
vappId : '486506335043368',
autoLogAppEvents : true,
xfbml : true,
version : 'v2.10'
});
FB.AppEvents.logPageView();
};
(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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<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.10&appId=486506335043368";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-login-button" data-max-rows="1" data-size="large" data- button-type="continue_with" data-show-faces="false" data-auto-logout- link="false" data-use-continue-as="false"></div>
</body>
</html>
I think there are 2 possible problems:
1)You need to change js.src assignment to: js.src="https://connect.facebook.net/en_US/all.js";
2)I think Facebook does not support calls from a local file, the script has to be run on a file with an http:// or https:// URI.
See this answer.
I have been having issues with the way in which my facebook send button works on my website, you can see an example at http://mysocialrewards.com.au/hellofresh-discount-code/
I was wondering if anyone could help me figure out why it's not displaying correctly, I've tried everything I can, code is below:
<div class="fb-send" data-href="https://www.hellofresh.com.au/food-boxes/classic-box/?c=FRESH118" data-size="large"></div>
<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.7&appId=433230226813254";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
I've read the previous problems for other people in this situation but none of them rectify my issue.
Nothing shows up at all on my website when trying to implement this facebook like/stream to a website.. any ideas?
<html>
<head>
<title><hi></title></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 = "https://connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like-box" data-href="https://www.facebook.com/Aberliquidscreed" data-width="250px" data-height="400px" data-colorscheme="light" data-show-faces="true" data-header="true" data-stream="false" data-show-border="true"></div>
</body>
</htm>
Your missing your facebook SDK and facebook API call FB.init
Step one: (put this inside your header html tag and update the appid_goes_here with your id)
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'APPID_goes_here',
xfbml : true,
version : 'v2.2'
});
};
(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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
Step Two: (anywhere in content replace appid_goes_here with your api key)
<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&appId=appid_goes_here&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
I need to execute javascript code after the facebook comments plugin is properly rendered on the page (basically I need to get the #content's height)
Comments placement somewhere in the content:
<div id="content">
<fb:comments href="http://domain.com/somelink.php" num_posts="25" width="728"></fb:comments>
</div>
Facebook init at the bottom of the page:
<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&appId=<?=MY_FACEBOOK_APP_ID?>&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
I tried this:
FB.Event.subscribe("xfbml.render", function(response) {
console.log($('#content').height());
});
...but got this error:
Uncaught ReferenceError: FB is not defined
Any ideas? Thanks!
js:
$(document).ready(function(){
window.fbAsyncInit = function() {
FB.init();
FB.getLoginStatus(function(response){
runFbInitCriticalCode();
console.log(response);
});
(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/ru_RU/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
};
});
html:
<div id="fb-root"></div>
i don't see any errors, but I can't show a group window, what I am doing wrong? as I've learned, all the params to the FB.INIT are optional, but how to see the error installing AND executing FB scripts?
Your JS is wrong. You're trying to include the Facebook JS inside of the facebook ready callback.
Try this.
$(document).ready(function(){
window.fbAsyncInit = function() {
FB.init();
FB.getLoginStatus(function(response){
runFbInitCriticalCode();
console.log(response);
});
}
(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/ru_RU/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
});