Rectangle 27 1

From mucking around in the Chrome Console, I discovered a global property, addthis_share, which seems to allow me to update the sharing URL.

window['addthis_share'].url = window.location.href;
window['addthis_share'].title = window.document.title;

I've encapsulated all the reloading code into a function, addthis_reload.

javascript - How do I refresh the sharing URL for the AddThis Facebook...

javascript addthis
Rectangle 27 0

Are you talking about this? I am going to go out on a limb here and say that although this is a pretty cool concept in theory, and is almost definitely possible to hack, it would be just that - a hack. Because, as I hope to show, this would be against Facebook guidelines. Although they have some very explicit terms and conditions under Policies, they also have some implicit terms under Principles, aka the spirit of the law. This one may well fall under :

  • Don't mislead, confuse, defraud, or surprise users.

This would very clearly be fraud under Facebook's terms because the Facebook user who makes a post is the one who owns the post. Therefore you are infringing on their ownership by removing their name and adding your website.

You own all of the content and information you post on Facebook, and you can control how it is shared through your privacy and application settings.

Because this is the user's content, I would strongly advise you to not try this as it may actually cause you to lose the usage of the Facebook API entirely.

For good measure I will add this final piece on advertising and promotion, which is also pertinent.

Advertisements and cross-promotions:

I am not a lawyer, so I cannot 100% guarantee you that Facebook won't look kindly on this, and if you get it to work, good for you. Just have a plan for what you integrate when you can't integrate Facebook's API anymore. Good luck.

Facebook embedded posts are a new feature to Facebook. As long as the post has been set to public by the originator, you will have the option to embed it.

You can embed and share. What you cannot do is change the name of the owner of the post. The post is still owned by the user. Just because they have allowed you to share it does not mean you can change the ownership.

javascript - Dynamically change URL for share button on Facebook Embed...

javascript jquery facebook facebook-graph-api
Rectangle 27 0

Liking its on your Fan Page is people liking that news entry not the link itself. If someone hits the share button on the same line as the like/comment/share then that will increase the share count.

Well that's the thing, they are "liking" the link on my fan page, facebook.com/pages/The-Berrics/123390707714463 it's the third post down as of right now. Only the "URL" was shared since a few days ago the likes occurring on link on my fan page are not be aggregated to the count on the like "button".

Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).

facebook - Like count from "Like" button vs sharing URL on fanpage - S...

facebook facebook-graph-api facebook-like xfbml
Rectangle 27 0

var url = window.location.href;
$('fb\\:share-button').attr('href', url)

jquery facebook share button dynamic url insert - Stack Overflow

jquery facebook url dynamic share-button
Rectangle 27 0

<link rel=canonical href=http://www.yourdomain.com/page-1 >
<meta property=og:url content=http://www.yourdomain.com/page-1 />

Can we change the url in IOS Safari browser's native sharing buttons(T...

ios facebook twitter safari sharing
Rectangle 27 0

After here and there for long i find the solution for above :

Replaced above meta tag with below

<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );  ?>

<?php if($image[0] != "" ){ ?>

<meta property="og:image" content="<?php echo $image[0]; ?>"  >

<?php } else { ?>

<meta property="og:image" content="logo.png"  >

<?php } ?>


<meta property="og:image:width" content="3523" >

<meta property="og:image:height" content="2372" >

<meta property="og:url" content="<?php echo the_permalink(); ?>"  >

<meta property="og:title" content="<?php echo the_title(); ?>"  > 

<meta property="og:site_name" content="Thefansworld" />

<meta property="og:description" content="" >  

<meta property="fb:app_id" content="3668661019" >

<meta property="fb:admins" content="" >

 <?php endwhile; wp_reset_query(); ?>

When pulling a webpage from an URL, Facebook caches it's content for later. It means, that if Facebook once pulls data from your site, and than your site changes (for example your og:image tags change), Facebook will not change the image, because it already has everything cached on its side.

Try visiting Facebook Debugger page and review what Facebook "sees". Using this tool forces Facebook to refresh data from the given URL. This is the best way to debug it.

When you make sure Facebook "sees" proper og:image tags, then make sure the images in the og:image are of proper minimum width/height (it's all explained in the fb debugger).

Facebook will not use an image from og:image if it does not meet FB's criteria. I strongly recommend this tool whenever there are any issues with content from your site on FB.

php - Custom Facebook share button with custom title,url,image in word...

php facebook wordpress facebook-opengraph opengraph
Rectangle 27 0

Ok. Solved it, was too hasty to publish question sorry.

Will mark as solved ASAP.

Share button (feed) with Direct URL opens entire facebook page - Stack...

facebook facebook-apps facebook-iframe facebook-sharer
Rectangle 27 0

The og:title links to og:url and the og:site_name is rendered pointing to your site's domain automatically.

Facebook Like button shares root URL instead of page - Stack Overflow

facebook facebook-like
Rectangle 27 0

You'd have to use the signed_request variable to store the the page you wanted to share. From what I remember there is an app_data field in this that allows you to store custom values - https://developers.facebook.com/docs/authentication/signed_request/

You'd then have to extract the custom variable from the signed_request->app_data when the page is requested to determine which content to load. You could then obviously share the link to the fb page with the signed_request tacked on. It is still requesting just one page, but kinda simulates deep-linking.

facebook - How to Link FB Share button to URL inside Application? - St...

facebook url iframe share
Rectangle 27 0

From mucking around in the Chrome Console, I discovered a global property, addthis_share, which seems to allow me to update the sharing URL.

window['addthis_share'].url = window.location.href;
window['addthis_share'].title = window.document.title;

I've encapsulated all the reloading code into a function, addthis_reload.

javascript - How do I refresh the sharing URL for the AddThis Facebook...

javascript addthis
Rectangle 27 0

Basic example from the docs:

FB.ui({
  method: 'share',
  href: 'https://developers.facebook.com/docs/',
}, function(response){});

...and forget about the share button, just use your own button and call FB.ui on click.

thanks for the reply can u please advice me where do i put this code ?

you just call it in a click handler of your custom button, thats all

ive added some information about the javascript sdk, you may want to read the links

it does not get writopedia.org/THCComment.aspx#2 because given url contain url with #

you should not use urls with an anchor then

jquery - change facebook share button url dynamically - Stack Overflow

jquery facebook
Rectangle 27 0

Just add following two lines inside your <Head> Tag, you should be able to resolve the issue.

<link href="http://sub.domain.com/default.aspx?foo=bar" rel="canonical">
<meta content="http://sub.domain.com/default.aspx?foo=bar" property="og:url">

Here I just hard coded the url, but while you implement it, make sure that the url of each page is dynamic. You can use $SERVER variables to generate the urls of corresponding pages.

Facebook Like button shares root URL instead of page - Stack Overflow

facebook facebook-like
Rectangle 27 0

You not mention which server side language used. Assumed PHP

$url=$_SERVER['REQUEST_URI'];
 <div class="fb-share-button" data-href="<?php echo $url;?>"></div>
<script type="text/javascript">window.location.protocol = "http";
window.location.host = "example.com"
window.location.pathname = "index.html"
var shareURL = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname;
document.write('<div class="fb-share-button" data-href="'+shareURL+'"></div>');
</script>

Thanks for the quick reply but it's not quite as simple as that. If you embed a post on a website, the share functionality is within that, it is not an individual share button.

javascript - Dynamically change URL for share button on Facebook Embed...

javascript jquery facebook facebook-graph-api
Rectangle 27 0

You can gain the url using

var href = window.location

you can gain the page title using

var title = document.title

To make the FB share button dynamic, you will either have to reload or edit the it's data attributes to match the current values. Also after a quick look at the docs for the GB share button, there is no option to set the title just the HREF. Docs can be found here.

So for your example, after you change the url, also run the following code:

jQuery(document).on('ready', function($){
    var url = window.location;  
    $('.fb-share-button').attr('data-href', url);
});

Thanks for the support and quick reply. Here is the Share Button Code generated by FB.. <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>

I need just the html part, not the script. Also wrap your code in ` to format it correctly.

Hi MJ, I have just updated my query.. is that what your are looking for. Please revert

I am unable to get the url value replaced with the above code.. Where am I gone wrong.. Could u please help MJ.. Thanks

javascript - Facebook Share Button for Dynamic Url - Stack Overflow

javascript jquery facebook-like facebook-social-plugins
Rectangle 27 0

To share content from not publicly accessible page use Feed Dialog

Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).

Facebook share button is sharing my login page instead of current page...

facebook facebook-javascript-sdk share facebook-social-plugins
Rectangle 27 0

I had the same problem, but I found out that you could simply call addthis.toolbox() when you want the links to update.

Thanks @eh1160, your response is a bit more in line with the question.

javascript - How do I refresh the sharing URL for the AddThis Facebook...

javascript addthis
Rectangle 27 0

One approach can be this that you store $id as an attribute with image like this:

<img id = "share_button" src="img/share.png" page_id=<?php echo $id?>/>
<script type="text/javascript">
 $(document).ready(function(){
   $('#share_button').click(function(e){
     e.preventDefault();
     var id = $(this).attr('page_id');
   FB.ui(
 {
    method: 'feed',
    name: 'This is the content of the "name" field.',
    link: ' http://www.test.com/test.php?id='+ id,
    picture: '',
    caption: 'This is the content of the "caption" field.',
    description: 'This is the content of the "description" field, below the caption.',
    message: ''
    });
   });
 });
 </script>

Note that this will work if you are generating HTML usinh PHP.

Hi mishra! im getting error on this part: link: ' test.com/test.php?id='+ id', i think the error is the apostrophe

This may be due to encoding..Does fb does encoding of the link provided?

@user2434677 I think it is takink '$id' like this, thats why extra quotes are coming.

Please at least make that a data attribute, instead of polluting the HTML with arbitrary attributes.

php - How to control url once share button facebook clicks - Stack Ove...

php ajax facebook
Rectangle 27 0

Do you have a <link rel="canonical" /> tag that specifies them as the same page?

Just an educated guess - never seen the canonical links affect Open Graph Protocol sharing before.

<meta property="og:url" ... /> tag will also do it. I haven't tried but would guess the answer here is appending the "foo" get parameter to both these tags (assuming they're set, and assuming that they both currently reference the page sans params).

Facebook Like button shares root URL instead of page - Stack Overflow

facebook facebook-like
Rectangle 27 0

The facebook share button (or the share url) is deprecated, you can read it in the docs:

The Share button has been deprecated in favor of the Like button, and will no longer be supported. Please use the Like button whenever possible to drive maximum traffic to your apps.

We deprecated the Share Button when we launched the Like button, because the Like button improves clickthrough rates by allowing users to connect with one click, and by allowing them to see which of their friends have already connected.

You can maybe find what's wrong here, but the right thing to do is to stop using it altogether.

Thanks a lot - appreciated

facebook - share button taking wrong url - Stack Overflow

facebook url share