Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🔗 Generates Social Sharing Url Strings

License

NotificationsYou must be signed in to change notification settings

noeldelgado/share-url

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NPM VersionMinzipped sizeLicenseKnown VulnerabilitiesLibraries.io dependency status for latest releaseTotal alertsLanguage grade: JavaScript

Generates social sharing urls without downloading its third party scripts. Adaptable to any UI.

Supported:Facebook,Twitter,Telegram,Whatsapp,Pinterest,Reddit,Linkedin,e-mail.

Demo

https://noeldelgado.github.io/share-url/

Dependencies

None

Installation

NPM

npm i share-url --save

Or as a<script> tag from a CDN asShareUrl:

Unkpkg CDN

<scriptsrc="https://unpkg.com/share-url"></script>

jsDelivr CDN

<scriptsrc="https://cdn.jsdelivr.net/npm/share-url"></script>

Usage Example

// jsx<ahref={ShareUrl.facebook({u:'https://google.com'})}>  Share on Facebook</a>
// jsdocument.querySelector('a').href=ShareUrl.facebook({u:'https://google.com'});

facebook

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

ShareUrl.facebook({u:'http://google.com',});// => 'https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fgoogle.com'

whatsapp

Sourcehttps://api.whatsapp.com/send?text={text}

ShareUrl.whatsapp({text:'Check out http://google.com',});// => 'https://api.whatsapp.com/send?text=Check%20out%20https%3A%2F%2Fgoogle.com'

telegram

Sourcehttps://t.me/share/url?url={url}&text={text}

ShareUrl.telegram({url:'https://google.com',text:'Check out',});// => https://t.me/share/url?url=https%3A%2F%2Fgoogle.com&text=Check%20out

twitter

Sourcehttps://twitter.com/share?text={text}&url={url}

ShareUrl.twitter({text:'custom share text',in_reply_to:'471716611724812288',url:'https://dev.twitter.com/web/tweet-button',hashtags:'example,demo',via:'twitterdev',related:'twitterapi,twitter',});// => 'https://twitter.com/share?text=custom%20share%20text&in_reply_to=471716611724812288&url=https%3A%2F%2Fdev.twitter.com%2Fweb%2Ftweet-button&hashtags=example%2Cdemo&via=twitterdev&related=twitterapi%2Ctwitter'

pinterest

Sourcehttps://pinterest.com/pin/create/button/?url={url}

ShareUrl.pinterest({url:'http://www.flickr.com/photos/kentbrew/6851755809/',media:'http://farm8.staticflickr.com/7027/6851755809_df5b2051c9_z.jpg',description:'Next Stop Pinterest',});// => 'https://pinterest.com/pin/create/button/?url=http%3A%2F%2Fwww.flickr.com%2Fphotos%2Fkentbrew%2F6851755809%2F&media=http%3A%2F%2Ffarm8.staticflickr.com%2F7027%2F6851755809_df5b2051c9_z.jpg&description=Next%20Stop%20Pinterest'

reddit

Sourcehttp://www.reddit.com/submit?url={url}

ShareUrl.reddit({url:'//www.reddit.com/buttons',title:'Buttons!',});// => 'http://www.reddit.com/submit?url=%2F%2Fwww.reddit.com%2Fbuttons&title=Buttons!'

linkedin

Sourcehttps://linkedin.com/sharing/share-offsite/?url={url}

ShareUrl.linkedin({url:'http://developer.linkedin.com',});// => 'https://linkedin.com/sharing/share-offsite/?url=http%3A%2F%2Fdeveloper.linkedin.com'

email

Sourcemailto:{to}?subject={subject}&body={body}

ShareUrl.email({to:'nowhere@mozilla.org',cc:'nobody@mozilla.org',subject:'This is the subject',body:'This is the body - https://developer.mozilla.org/',});// => 'mailto:nowhere@mozilla.org?cc=nobody%40mozilla.org&subject=This%20is%20the%20subject&body=This%20is%20the%20body%20-%20https%3A%2F%2Fdeveloper.mozilla.org%2F'

License

MIT ©Noel Delgado


[8]ページ先頭

©2009-2025 Movatter.jp