share-facebook

1.0.1 • Public • Published

share-facebook Build Status codecov

Create a Facebook share url with ease

Install

$ yarn add share-facebook

Usage

const shareFacebook = require('share-facebook')
 
shareFacebook({
  quote: 'Check this library to help you create share facebook url',
  href: 'https://bukinoshita.io',
  redirect_uri: 'https://bukinoshita.io',
  app_id: 'APP_ID'
})
// https://www.facebook.com/dialog/share?app_id=APP_ID&redirect_uri=https://bukinoshita.io&display=page&quote=Check%20this%20library%20to%20help%20you%20create%20share%20facebook%20url

Examples

Check the examples

API

shareFacebook([options])

Returns a string

app_id

Type: string
Example: APP_ID
Required

Your app's unique identifier.

redirect_uri

Type: string
Example: https://bukinoshita.io
Required

The URL to redirect to after a person clicks a button on the dialog. Required when using URL redirection.

display

Type: string
Default: page
Example: page

Determines how the dialog is rendered.

  • If you are using the URL redirect dialog implementation, then this will be a full page display, shown within Facebook.com. This display type is called page.
  • If you are using one of our iOS or Android SDKs to invoke the dialog, this is automatically specified and chooses an appropriate display type for the device.
  • If you are using the Facebook SDK for JavaScript, this will default to a modal iframe type for people logged into your app or async when using within a game on Facebook.com, and a popup window for everyone else. You can also force the popup type when when you use the Facebook SDK for JavaScript, if necessary.
  • Mobile web apps will always default to the touch display type.

href

Type: string
Example: https://bukinoshita.io

The link attached to this post. Required when using method share. Include open graph meta tags in the page at this URL to customize the story that is shared.

hashtag

Type: string
Example: #facebook

A hashtag specified by the developer to be added to the shared content. People will still have the opportunity to remove this hashtag in the dialog. The hashtag should include the hash symbol.

quote

Type: string
Example: share with FB

A quote to be shared along with the link, either highlighted by the user or predefined by the developer, as in a pull quote on an article.

mobile_iframe

Type: boolean
Default: false
Example: true

If set to true the share button will open the share dialog in an iframe on top of your website (For more information see Mobile Web Share Dialog. This option is only available for mobile, not desktop.

Related

License

MIT © Bu Kinoshita

Package Sidebar

Install

npm i share-facebook

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

6.37 kB

Total Files

7

Last publish

Collaborators

  • bukinoshita