青いやつの進捗日記。

メモとしてべんきょうのしんちょくをかいていきます。あとで自分が検索しやすいもん

SNSのシェア機能の実装

developer.mozilla.org

これでURLを取得しエンコード

const url = encodeURIComponent(location.href);

blog.maromaro.co.jp

tsudoi.org

getTwitterUrl(url) {
  return `https://twitter.com/share?${url}`;
}

みたいな感じ


追記。Pinterestはシェア対象の画像も渡してあげないとエラーが出てうまくシェア出来ないみたいです。