Get started with social-sharing CDN

MIT licensed

Library lets websites add social media sharing buttons for easy content sharing.

Tags:
  • social
  • sharing

Stable version

Copied!

How to start using social-sharing CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with social-sharing CDN - cdnhub.io</title>
  <link rel="stylesheet" href="https://cdn.cdnhub.io/social-sharing/1.7.2/css/social-sharing.min.css">
</head>
<body>
  <button id="share-button">Share on Social Media</button>
  <script src="https://cdn.cdnhub.io/social-sharing/1.7.2/js/social-sharing.min.js"></script>
  <script>
    document.addEventListener('DOMContentLoaded', function() {
      const shareButton = document.getElementById('share-button');
      const sharing = new window.socialSharing("Share this", "https://example.com");

      shareButton.addEventListener('click', function() {
        sharing.openFacebook();
      });
    });
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!

All versions