CM.
CM.

Reputation: 680

share on facebook from chrome extension

I want to share current opened tab url on facebook wall from chrome extension. For that, I was using https://facebook.com/share.php earlier which was giving me login option first and then share box.

Since facebook has deprecated this method, how can I post/share on my wall from chrome extension? FB.api is another option but for that I may have to authenticate with facebook first. How can I achieve this from chrome extension?

Upvotes: 2

Views: 2479

Answers (3)

terales
terales

Reputation: 3200

Accepted answer doesn't work for me.

Found another way to share on facebook (jsfiddle):

https://www.facebook.com/sharer/sharer.php?u={url}

There is a tool that generates sharing dialog: https://apps.lazza.dk/facebook/Has Facebook sharer.php changed to no longer accept detailed parameters?), here is an reverse engineered example:

https://www.facebook.com/sharer/sharer.php
?u=${url}
&picture=${pictureUrl}
&title=${title}
&caption=${caption}
&quote=${quote}
&description=${description}

This link generates sharing dialog like this:

Sharing with quote

For a bigger picture we should omit quote:

Sharing with big image

Upvotes: 1

Pablo Halpern
Pablo Halpern

Reputation: 980

Here's another method: Create a bookmark and set name to "Share on Facebook" and the URL to:

javascript:var d=document,f='http://www.facebook.com/share',l=d.location,e=encodeURIComponent,p='.php?src=bm&v=4&i=1274665734&u='+e(l.href)+'&t='+e(d.title);1;try{if (!/^(.*\.)?facebook\.[^.]*$/.test(l.host))throw(0);share_internal_bookmarklet(p)}catch(z) {a=function() {if (!window.open(f+'r'+p,'sharer','toolbar=0,status=0,resizable=1,width=626,height=436'))l.href=f+p};if (/Firefox/.test(navigator.userAgent))setTimeout(a,0);else{a()}}void(0)

Note: I didn't invent this method and I don't remember where I got it from, but it works great for both Chrome and Firefox. (I haven't tried it on other browsers.)

EDIT: I found the original source: https://www.facebook.com/share_options.php On this page, just drag the "Share on Facebook" icon to your bookmarks bar.

Upvotes: 0

Raghvendra Parashar
Raghvendra Parashar

Reputation: 4053

You can use feed dialog, find more detail here

This is a direct URL

https://www.facebook.com/dialog/feed?
  app_id=458358780877780&
  link=https://developers.facebook.com/docs/reference/dialogs/&
  picture=http://fbrell.com/f8.jpg&
  name=Facebook%20Dialogs&
  caption=Reference%20Documentation&
  description=Using%20Dialogs%20to%20interact%20with%20users.&
  redirect_uri=https://mighty-lowlands-6381.herokuapp.com/

Upvotes: 4

Related Questions