-1

I want to post custom image and text on facebook without meta tag. here is my working code with app id

window.fbAsyncInit=function()
{FB.init({appId:"myappid",autoLogAppEvents:true,xfbml:true,version:"v2.10"});
FB.AppEvents.logPageView()};
(function(e,a,f){
var c,b=e.getElementsByTagName(a)[0];if(e.getElementById(f)){return}c=e.createElement(a);c.id=f;
c.src="//connect.facebook.net/en_US/sdk.js";b.parentNode.insertBefore(c,b)}(document,"script","facebook-jssdk"));



   var title =jQuery(".title ").text();
    var discription=jQuery(".imgsrcfb").val();
    var url=jQuery(".url").val();
    var image=jQuery(".image").src();

FB.ui( {
        method:"share_open_graph", action_type:"og.likes", action_properties:JSON.stringify( {
            object: {
                "og:url": url, "og:title": title , "og:description": discription, "og:image": image
            }
        }
        )
    }
    , function(e) {}
    )

I have applied all method but none of work Before they worked. But in new facebook api upates they just stop working. Here is my reference site (They also stopped working) http://drib.tech/programming/dynamically-change-facebook-open-graph-meta-data-javascript

Please help me to shortout this Thank you in advance.

  • 1
    Using `method:"share_open_graph"` for this was the last loophole Facebook left open in this regard for a while - and now they closed it. You can not do this any more - the only situation where you can still specify these values dynamically, is when you post to a page you own, and have claimed “ownership” of the domain the content you are sharing is from first. – 04FS Oct 01 '19 at 10:46
  • Hi Thanks for your response. Can you please let me know Actually what I have to do for this? You mean for ownership I have to complete varification process ? ( http://prntscr.com/pdbn78 ) – phpdeveloper aegisbit Oct 01 '19 at 11:05
  • For links that your users share to their own timelines, you can not do this any more at all. – 04FS Oct 01 '19 at 11:07

1 Answers1

0

Dynamic OG Tags are not possible anymore, you have to change the OG Tags of the page source if you want to show different information. share_open_graph was just a workaround that is deprecated now.

andyrandy
  • 72,880
  • 8
  • 113
  • 130
  • So is there any method to share my information on facebook? – phpdeveloper aegisbit Oct 01 '19 at 11:22
  • yes, by changing the values in the page source of the shared url – andyrandy Oct 01 '19 at 12:16
  • I want to change image on same url Like post share with different image Every post have different image Like www.example.com/post1 www.example.com/post2 – phpdeveloper aegisbit Oct 03 '19 at 07:17
  • different image means you have to use a different url. but that is what you have anyway, right? – andyrandy Oct 03 '19 at 10:50
  • No I want share different images on single URL. Like here http://prntscr.com/peb0v6 On each square have a share functionality and every sqaure have different image When we click on square a popup will open with a unique image and test. So I want to share it with open graph. So is there any other method ? – phpdeveloper aegisbit Oct 03 '19 at 11:31
  • then, you have to use different urls per image. you can just use a parameter though: post1?img=1 and so on - and fill the open graph tags/image depending on the parameter. – andyrandy Oct 03 '19 at 15:00
  • **yes its work** But its not working on 1st time when I share image on 2nd time then its working. – phpdeveloper aegisbit Oct 18 '19 at 07:24
  • in that case, this may help you: https://stackoverflow.com/questions/12100574/is-there-an-api-to-force-facebook-to-scrape-a-page-again – andyrandy Oct 18 '19 at 10:54