← All articles
Action requiredSummer '26Lightning Web Security / LWC

Action Required: Replace LWC data: Downloads with Blob URLs

LWS can block client-generated downloads that still use data: links; replace those links with Blob URLs.

Required action

Salesforce announced the HTMLAnchorElement.prototype.href distortion in Summer ’26, but it isn’t enforced in that release; Salesforce says it will be enforced in Winter ’27.[2] Winter ’27 may already be live in your org, depending on its instance upgrade date. Check the maintenance schedule for your instance in Salesforce Trust.[4] If your org has upgraded and LWS is enabled, replace affected data: anchor links now; otherwise, replace them before the upgrade.

If you leave a data: link in place, LWS blocks it when the distortion is enforced, so the affected download or export stops working for users.[2]

Find affected components

Search component code and shared utilities for data: URL construction, especially code that sets an anchor href before triggering a download. This affects Lightning Experience, LWR-based Experience Cloud sites, and Lightning web components in Aura sites when LWS is enabled; it is not a general ban on every URL in every Salesforce context.[2]

Use a Blob URL

Create a Blob from the file contents and use URL.createObjectURL() to generate the download URL:[2]

const blob = new Blob([text], { type: 'text/plain' });
const blobUrl = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = blobUrl;
link.download = 'export.txt';
link.click();
setTimeout(() => URL.revokeObjectURL(blobUrl), 1000);

Set an explicit MIME type when creating the Blob; LWS permits some types, sanitizes others, and blocks the rest. Without a type, the object might not contain the expected content.[3] Choose a filename that matches the export, then test the download in an LWS-enabled org/site. Blob URLs inherit the creating page’s origin and are subject to the same-origin policy.[2]

Sources

  1. API Distortion Changes in Lightning Web Securityhttps://help.salesforce.com/s/articleView?id=release-notes.rn_lc_lws_distortion_changes.htm&language=en_US&release=262&type=5
  2. HTMLAnchorElement Distortion Blocks data: URI Schemehttps://help.salesforce.com/s/articleView?id=release-notes.rn_lc_lws_htmlanchorelement_distortion.htm&language=en_US&release=262&type=5
  3. Specify a MIME Type for Blob Objects in Lightning Web Securityhttps://developer.salesforce.com/docs/platform/lightning-components-security/guide/lws-mime.html
  4. Salesforce Trust Statushttps://status.salesforce.com/