share-facebook
v1.0.1
Published
Create a Facebook share url with ease
Downloads
9
Maintainers
Readme
share-facebook
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"e=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 orasync
when using within a game on Facebook.com, and apopup
window for everyone else. You can also force thepopup
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
- share-twitter — Create a Twitter share url with ease
License
MIT © Bu Kinoshita