Web Share API Integration

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1215
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1043
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    823
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    815

Web Share API Implementation on Website

Web Share API invokes native OS sharing dialog — the same that opens when sharing from mobile app. User sees their apps list: Telegram, WhatsApp, Notes, Mail, AirDrop. No custom buttons for each social media, no popups with icons.

Support: iOS Safari 12.1+, Android Chrome 61+, Edge 79+. Desktop support partial — works in Chrome/Edge on Windows, not in Firefox and Safari macOS (without extensions).

Basic Sharing

interface ShareData {
  title?: string
  text?: string
  url?: string
  files?: File[]
}

async function share(data: ShareData): Promise<void> {
  if (!navigator.share) {
    throw new Error('Web Share API not supported')
  }

  // Check browser supports this data type
  if (!navigator.canShare(data)) {
    throw new Error('This content type not supported for sharing')
  }

  await navigator.share(data)
}

File Sharing

async function shareFile(file: File, title?: string): Promise<void> {
  const data: ShareData = { files: [file], title }

  if (!navigator.canShare?.(data)) {
    // Fallback: offer download
    const url = URL.createObjectURL(file)
    const a = document.createElement('a')
    a.href = url
    a.download = file.name
    a.click()
    URL.revokeObjectURL(url)
    return
  }

  await navigator.share(data)
}

// Share Canvas as image
async function shareCanvas(
  canvas: HTMLCanvasElement,
  filename: string,
  title?: string
): Promise<void> {
  const blob = await new Promise<Blob>((resolve, reject) =>
    canvas.toBlob((b) => (b ? resolve(b) : reject(new Error('Error'))), 'image/png')
  )
  const file = new File([blob], filename, { type: 'image/png' })
  await shareFile(file, title)
}

React Component with Fallback

interface ShareButtonProps {
  url: string
  title?: string
  text?: string
  fallbackCopy?: boolean
}

function ShareButton({ url, title, text, fallbackCopy = true }: ShareButtonProps) {
  const [copied, setCopied] = useState(false)
  const supportsShare = typeof navigator !== 'undefined' && 'share' in navigator

  const handleShare = async () => {
    if (supportsShare) {
      try {
        await navigator.share({ url, title, text })
      } catch (e) {
        // User canceled — not an error
        if (e instanceof Error && e.name !== 'AbortError') {
          console.error('Share error:', e)
        }
      }
      return
    }

    if (fallbackCopy) {
      await navigator.clipboard?.writeText(url)
      setCopied(true)
      setTimeout(() => setCopied(false), 2000)
    }
  }

  return (
    <button onClick={handleShare}>
      {supportsShare ? 'Share' : copied ? 'Link copied' : 'Copy link'}
    </button>
  )
}

What's Involved

Utility share with support check and canShare, React component with fallback (copy to buffer), file and image support if needed, AbortError handling (user closed dialog).

Timeline: 2–3 hours.