Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To share an image your Progressive Web App generated, turn its image data into a File, check whether file sharing is supported, and call navigator.share() from a user-triggered action. Serve the app over HTTPS and keep a download fallback for browsers or file types that cannot use the native share sheet.

How image sharing works in a PWA

The Web Share API hands data to the device’s native sharing mechanism, which can offer installed apps such as messaging or social apps as destinations. For an image, the share payload should contain a File in its files property—not just a canvas or an arbitrary Blob reference. The receiving app and operating system determine which destinations are available.

MDN describes the API as a way for web apps to share text, links, or files with other apps through the underlying operating system: Web Share API. Availability and supported file types vary by browser and platform, so feature detection is more reliable than assuming a particular device can share a particular image.

Prepare the generated image as a File

If you create the image with a canvas, use canvas.toBlob() to get image bytes. The function below converts that Blob into a named File and checks whether the browser accepts it for sharing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Motorola Moto g - 2026 | Unlocked | Made for US 4/128GB | 50MP Camera | Pantone Slipstream, Cellular_Phone
  • Universal unlocked. Compatible with all major U.S. carriers, including Verizon, AT&T, T-Mobile and other prepaid carriers.
  • Super-bright, super-smooth 6.7" display. See your screen clearly even outdoors in sunlight, and enjoy seamless views with a fast-refreshing 120Hz display.*
  • AI-powered camera system. Take stunning photos in any light with the 50MP camera**, look your best with a 32MP selfie cam*****, and capture extreme close-ups.
  • Superfast 5G performance. Unleash your entertainment at 5G speed*** with the MediaTek Dimensity 6300 chipset and up to 12GB of RAM with RAM Boost****.
  • Long-lasting battery + TurboPower charging. Power through day after day with a 5200mAh battery, then get hours of power in just minutes.****
function canvasToBlob(canvas, type = "image/png", quality) {
  return new Promise((resolve, reject) => {
    canvas.toBlob((blob) => {
      if (blob) {
        resolve(blob);
      } else {
        reject(new Error("The browser could not encode the canvas image"));
      }
    }, type, quality);
  });
}

function makeImageFile(blob, fileName = "generated-image.png") {
  const type = blob.type || "image/png";
  return new File([blob], fileName, { type });
}

function canShareImage(file) {
  if (!navigator.share || !navigator.canShare) return false;
  return navigator.canShare({ files: [file] });
}

For an existing Blob, skip the canvas conversion and pass it to makeImageFile(). Set a filename with an extension that matches the actual image format, and preserve the Blob’s MIME type when it is set. MDN lists common image types including PNG, JPEG, WebP, GIF, AVIF, SVG, and TIFF, but that list is not a guarantee that every browser can share each type. Test at runtime with navigator.canShare().

Call the share method from a button

Put the native share call in a click or tap handler. The browser requires transient user activation for sharing; work that takes a long time before navigator.share() may cause that activation to expire. When practical, generate and prepare the image before the person presses Share.

const shareButton = document.querySelector("#share-image");
const downloadLink = document.querySelector("#download-image");
let preparedFile;

async function prepareImage() {
  const canvas = document.querySelector("#result-canvas");
  const blob = await canvasToBlob(canvas, "image/png");
  preparedFile = makeImageFile(blob, "generated-image.png");

  const objectUrl = URL.createObjectURL(blob);
  downloadLink.href = objectUrl;
  downloadLink.download = "generated-image.png";
  downloadLink.hidden = false;
}

shareButton.addEventListener("click", async () => {
  if (!preparedFile) {
    showMessage("Prepare the image before sharing or download it instead.");
    return;
  }

  const shareData = { files: [preparedFile] };
  if (!navigator.share || !navigator.canShare || !navigator.canShare(shareData)) {
    showMessage("Image sharing is not supported here. Use the download link instead.");
    return;
  }

  try {
    await navigator.share(shareData);
  } catch (error) {
    if (error.name === "AbortError") {
      // The user dismissed the share sheet; this is not an application failure.
      return;
    }
    console.error("Image sharing failed", error);
    showMessage("The image could not be shared. You can download it instead.");
  }
});

function showMessage(message) {
  document.querySelector("#share-status").textContent = message;
}

Example markup:

<canvas id="result-canvas"></canvas>
<button id="share-image" type="button">Share image</button>
<a id="download-image" hidden>Download image</a>
<p id="share-status" role="status"></p>

Call prepareImage() after the image has been generated or updated. If generation happens only after the Share button is tapped, await the work carefully: user activation can be lost during lengthy asynchronous processing. A more dependable interface has a separate Generate or Prepare action, followed by Share.

Rank #2
Samsung Galaxy A17 5G Smart Phone 128GB US 1 Yr Manufacturer Warranty Black
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.

Use a fallback when native sharing is unavailable

A downloadable file keeps the feature usable when the browser lacks file sharing, rejects the file type, or blocks the API. For images hosted online, another option is to copy a shareable URL, but that requires the image to be reachable by the intended recipient and any privacy or access rules to permit it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Download: offer the Blob as a file using an object URL and an anchor with a download attribute.
  • Copy a URL: useful when the image already has a stable, recipient-accessible URL.
  • Application-specific export: provide this only if your product has a real destination-specific integration.

Object URLs created with URL.createObjectURL() should be revoked once they are no longer needed, such as when replacing the generated image or when the page is closing. Do not revoke one immediately after assigning it to a visible download link, because the link still needs it.

Requirements that commonly block sharing

Secure context

The Web Share API is available only in secure contexts, normally pages served over HTTPS. A deployed PWA should use HTTPS. If the API is missing in production, confirm the page’s origin and security context before debugging the image itself. See MDN’s Web Share API availability notes.

Rank #3
Samsung Galaxy A16 5G 128GB Cell Phone, Unlocked Android Smartphone, Large AMOLED Display, Durable Design, Super Fast Charging, Expandable Storage, US Version, 2025, Blue Black (Renewed)
  • Charger NOT Included, 6.7" Super AMOLED FHD+, 90Hz Refresh Rate, 385 ppi, 800 nits (HBM), 1080x2340px, 5000mAh Battery
  • 128GB, 4GB RAM, microSDXC, Exynos 1330 (5nm), Octa-Core, Mali-G68 MP2 or Mali-G57 MC2 GPU
  • Rear Camera: 50MP, f/1.8 (wide) + 5MP, f/2.2 (ultrawide) + 2MP, f/2.4 (macro), LED flash, panorama, HDR; Front Camera: 13MP, f/2.0, Android 14, up to 6 major Android upgrades, One UI 6.1
  • 3G: HSDPA 850/900/1700(AWS)/1900/2100; 4G LTE: 1/2/3/4/5/7/12/13/14/20/25/26/28/29/30/38/39/40/41/48/66/71, 5G: 2/5/25/41/66/71/77/78 SA/NSA/Sub6/mmWave - Nano-SIM + eSIM
  • US Model – Global Connectivity – Compatible with Most GSM Carriers like T-Mobile, AT&T, MetroPCS, etc. Will Also work with CDMA Carriers Such as Verizon, Straight Talk.

User activation

Call navigator.share() directly in response to an explicit action such as a button click. Preparing a large image, waiting for network requests, or running lengthy work between the click and the share call can undermine the transient activation requirement. Precompute when possible, then call share from the button handler.

Permissions Policy

The document must be allowed to use the web-share Permissions Policy directive. This matters especially when the PWA is embedded in an iframe or served with restrictive policy headers. Review MDN’s web-share Permissions Policy documentation and ensure the embedding page or response policy permits it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Browser, platform, and file-type support

Support for native file sharing and individual image formats differs. Check both navigator.share and navigator.canShare({ files: [file] }) at runtime. A positive capability check means the browser considers that payload shareable; it cannot guarantee a particular destination app will appear or accept the file.

Rank #4
Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Blue
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.

Troubleshoot failed image sharing

Symptom Likely cause What to do
navigator.share is undefined The browser or context does not expose the API, or the page is not in a secure context. Use HTTPS, check the target browser and platform, and expose the download fallback.
navigator.canShare({ files: [file] }) returns false File sharing or that file’s data/type is unsupported or cannot be validated. Confirm the File has non-empty image bytes, a sensible filename, and the correct MIME type; keep the fallback available.
The call rejects with NotAllowedError Sharing may have been called without valid user activation or blocked by policy. Invoke it from a visible user action and check the web-share Permissions Policy.
The share sheet opens, then closes The user may have cancelled the share operation. Treat AbortError as cancellation, not a crash, and leave the image available to download.
The canvas Blob is null The browser could not encode the canvas in the requested format. Check canvas dimensions and encoding type; handle the failure before offering Share.
Sharing works for one format but not another File-format support varies by implementation. Use canShare() on the actual File, and consider generating a commonly supported alternative such as PNG or JPEG when appropriate.

The share() method returns a Promise and can reject when sharing is disallowed or the supplied data is invalid. Handle the rejection rather than assuming the operating system will always complete the operation. MDN’s Navigator.share() and Navigator.canShare() references describe the methods and their behavior.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Outgoing sharing is not Web Share Target

To send an image that your PWA generated, use the Web Share API described above. The separate Web Share Target API lets a PWA receive content shared into it from another app; it uses a share_target member in the web app manifest and commonly a POST endpoint for binary data. Receiving is optional and is not needed to implement outgoing image sharing. See MDN’s share_target manifest reference.

Or skip the browser setup

If the goal is to capture a website image rather than share an image your own PWA generated, ScreenshotNeo is a website screenshot API and MCP server for developers. A GET request takes a URL and returns an image or PDF; it is not a replacement for the Web Share API when you need to send a canvas-generated file into a device’s share sheet.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Tracfone Motorola Moto G 2025, 64GB, Saphire Blue (Locked to
  • Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Tracfone plan required, activating is easy, just 3 steps.
  • DISPLAY: Immersive viewing on a 6.7-inch super-bright 120Hz display with powerful stereo speakers and Bass Boost for cinematic entertainment.
  • CAMERA SYSTEM: Advanced 50MP Quad Pixel camera captures sharp, detailed photos and videos in any lighting condition
  • PERFORMANCE: Lightning-fast 5G connectivity paired with a powerful processor and RAM Boost for smooth multitasking.
  • BATTERY LIFE: Long-lasting 5000mAh battery with TurboPower charging technology delivers hours of power in minutes.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, with response headers indicating the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients.

The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Every feature is on every plan. Create an account for 1,000 free screenshots a month, with no card required.

Frequently Asked Questions

Does a PWA share a canvas directly?

No. Convert the canvas output to a Blob and then a File, and pass that File in the share payload’s files array.

Can I share an image to WhatsApp or Messages specifically?

The native share sheet offers destinations available on the user’s device; the web page cannot guarantee that a particular app will be installed, displayed, or accept the file.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Is Web Share Target needed to share an image out of my PWA?

No. Web Share Target is for receiving content into your PWA. Outgoing sharing uses the Web Share API.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.