直接 URL スキームを活用することで、サードパーティの重いトラッキングスクリプトを読み込むことなく、安全で高速な SNS シェアボタンを実装できます。
SNS 共有用 URL エンドポイント
Twitter / X
https://twitter.com/intent/tweet?url={URL}&text={TEXT}&via={USER}&hashtags={TAGS}
https://www.facebook.com/sharer/sharer.php?u={URL}
https://www.linkedin.com/sharing/share-offsite/?url={URL}
Telegram
https://t.me/share/url?url={URL}&text={TEXT}
https://api.whatsapp.com/send?text={TEXT}%20{URL}
https://reddit.com/submit?url={URL}&title={TITLE}
ネイティブ Web Share API (モダンブラウザ)
if (navigator.share) {
navigator.share({
title: document.title,
text: 'こちらのチートシートをチェックしてみてください!',
url: window.location.href
});
}