Is there some way to share some dynamic data from my page on facebook and twitter ?
I tried this code with static data and it worked, but I apply it dynamically it doesn't.
For Twitter:
<a href="http://twitter.com/share"
data-url="http://your.url.com/yourdynamicpage"
class="twitter-share-button"
data-text="What should I share?"
data-count="horizontal">Tweet</a>
For Facebook:
<img src="/path/to/your/image/" width="12" height="12" alt="alt" />
What am I doing wrong?
http://shantacreations.com/facebook_share_old/example_1/share.php/
yes the above link are functioning as you would like to make function.
Related
I am using facebook sdk
<script src='http://connect.facebook.net/en_US/all.js'></script>
and using method
FB.ui({
method: "send",
link: 'http://test.com/'
});
Is there is any option to send text and image
I also used
FB.ui({
method: "send",
link: 'http://test.com/',
description: 'custom text hello this is my content',
picture: 'hello.jpg'
});
but this is not working there is FB.ui method pickup automatically text and image from link but I need to send custom please help if is there
The send method/dialog does not accept a 'picture' parameter.
Facebook Javascript SDK Documentation
The send dialog only allows you to add a link, the Open Graph data of that link will be used. There is no way to use custom data for the link.
Send Dialog parameters:
https://developers.facebook.com/docs/sharing/reference/send-dialog
Open Graph tags:
https://developers.facebook.com/docs/sharing/best-practices#tags
http://ogp.me/
Keep in mind that users should know what they can expect behind the link, so it´s a bad idea to use custom data instead of existing Open Graph data directly from the link.
<a title="send to Facebook"
href="http://www.facebook.com/sharer.php?s=100&p[title]=YOUR_TITLE&p[summary]=YOUR_SUMMARY&p[url]=YOUR_URL&p[images][0]=YOUR_IMAGE_TO_SHARE_OBJECT"
target="_blank">
<span>
<img width="14" height="14" src="'icons/fb.gif" alt="Facebook" /> Facebook
</span>
</a>
Is there a way to pull someone's profile picture from Twitter and display it on my site without Auth or Twitter API?
I think it was possible with API v1.1 but support for that has been stopped.
Any suggestions or advice?
There's the easy way, or the hard way :-)
The easy way is to use a service like http://avatars.io/
Simply call http://avatars.io/twitter/edent to get my avatar.
The hard way?
You can scrape it directly off the Twitter site. It's not pretty - but it works.
If you look at the source for my Twitter page - https://twitter.com/edent - you will see this block of HTML.
<a href="/settings/profile"
class="account-summary account-summary-small"
data-nav="edit_profile">
<div class="content">
<div class="account-group js-mini-current-user" data-user-id="14054507" data-screen-name="edent">
<img class="avatar size32" src="https://pbs.twimg.com/profile_images/417381475101593601/UUi48hOg_normal.jpeg" alt="" data-user-id="14054507">
<b class="fullname">Terence Eden</b>
<span class="screen-name hidden" dir="ltr">#edent</span>
<small class="metadata">
Edit profile
</small>
</div>
</div>
</a>
You can look for the first instance of <img class="avatar size32" and grab the src from that.
I want to share referral url from my site via Twitter/Facebook share buttons. I have customized share buttons.
I am able to share referral url on these two sites but because target=_blank, facebook's Share Link and Twitter's Tweet page appears on a new tab.
I want then in an iFrame so that user won't leave my website while sharing referral links.
Facebook Share Code
<a title="send to Facebook"
href="http://www.facebook.com/sharer.php?s=100&p[title]=YOUR_TITLE&p[summary]=YOUR_SUMMARY&p[url]=YOUR_URL&p[images][0]=YOUR_IMAGE_TO_SHARE_OBJECT"
target="_blank">
<span>
Twitter Share Code
<a href="#" id="shareWithTwitter" onclick="shareWithTwitter()">
<img class="social-share" src="<?php echo site_url('img/twitter.png'); ?>"/>
</a>
function shareWithTwitter()
{
var url = 'https://twitter.com/home?status=Join Fashion on '+$('#referal-URL').val();
$('#shareWithTwitter').attr('href',url);
}
All you have to do is adding a name attribute to the iframe and target your link to it.
<iframe name="iframeName" style="iframe style"></iframe>
link
open link in iframe
I am trying to share a page of user on FB by giving the full url of that page. But it's not picking any title & other OG meta tags, which I have given on the page.
here is what I am using :-
<div class="img">
<a href='http://www.facebook.com/sharer.php?s=100&p[url]=https://pad.panda.org/content /nav_content.cfm?uNC=86290929&uXNavID=123906' target="_blank" onclick="javascript:window.open(this.href,
'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
<img src="images/facebook.jpg" alt="FaceBook" />
</a>
Try to get rid of all warning in the Facebook Debug Tool.
I'm trying to figure out just how a particular function works on a Facebook page, and being no friend of JS syntax, am having trouble. Here's the question mark bit:
<a href="#" clicktoshowdialog="my_dialog" onclick="
(new Image()).src = '/ajax/ct.php?app_id=4949752878&action_type=3&post_form_id=3b933f46f9c4c44981e51b90c754bfce&position=2&' + Math.random();
FBML.clickToShowDialog("app4949752878_my_dialog");
return false;">
<img src="linktopicture" title="Are your friends fans?" width="190" height="230" />
</a>
<div style="display:none">
<div id="app4949752878_my_dialog" fbcontext="aa3fcff8e653">
<div class="app_content_4949752878" style="padding:10px">
<div with hidden then exposed content...
The functionality of this is an image that, when clicked, pops out the previously hidden div. I know that the app###### is prepended to all JS used in Facebook to limit its scope. I'm confused by the anchor parameter of
clicktoshowdialog="mydialog"
What is that identifying, and how is it targeting the div that's exposed when the image is clicked? Thanks for any clarification, and let me know if I can post any more sample code.
According to the wiki it's just for opening the dialog (which is defined at the bottom). Facebook generates the JS to open the dialog. The attribute got post-processed and the JS code (that you see in the onclick= attribute) was generated on it's basis.