Embedded Document Viewer Download Fails Due to Missing iframe Sandbox PermissionsIssue When the Document Viewer is embedded in an iframe using the sandbox attribute, the 'Download File' button within the viewer fails to download attachments even though the viewer loads and displays the document correctly. Symptoms The Download button in the embedded Document Viewer does not trigger a file downloadClicking the download icon opens a new tab without completing the downloadDownloading the same attachment through Manage Attachments on the record succeedsThe embedded viewer renders and displays the document correctly but the download functionality is brokenThe issue may appear after platform upgrades where the iframe sandbox attribute was added or modified Facts The iframe sandbox attribute restricts the capabilities of all content running within the embedded frameSandbox restrictions apply not only to the iframe itself but also to any new tabs or windows opened from within itWithout the correct set of sandbox permissions, interactive features such as file downloads, form submissions, and scripts are blocked even if the viewer appears to load correctlyThe following sandbox permissions are required for the embedded Document Viewer to function fully: PermissionPurposeallow-same-originAllows the iframe to access the same origin as the parent page, required for authentication and session contextallow-scriptsAllows JavaScript to run within the iframe, required for viewer interactivityallow-formsAllows form submissions within the iframeallow-popupsAllows the viewer to open new tabs or windowsallow-downloadsAllows file downloads initiated from within the iframe, required for the Download File button to work Omitting allow-downloads specifically blocks file downloads from within the iframe and from any new tabs opened by it, even when all other permissions are presentThis is a browser-enforced security restriction and is not controlled by ServiceNow platform settings Release All supported releases where an iframe sandbox attribute is used to embed the Document Viewer or attachment viewer Cause When the allow-downloads permission is absent from the iframe sandbox attribute, the browser enforces a restriction that prevents any file download from being initiated within the sandboxed context. Since the Document Viewer's Download File button triggers a download from within the iframe, the browser silently blocks it. New tabs opened from the sandboxed iframe inherit the same restrictions, so the download fails regardless of how the viewer attempts to initiate it. Resolution Ensure the iframe sandbox attribute includes all required permissions for the embedded Document Viewer to function correctly: Complete sandbox attribute: <iframe src="<viewer_url>" width="1000" height="750" sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-downloads"> </iframe> Steps to apply: Navigate to the UI macro, UI page, or custom widget where the Document Viewer is embedded in an iframeLocate the iframe element and review the existing sandbox attributeEnsure all five required permissions are present in the sandbox value: allow-same-originallow-scriptsallow-formsallow-popupsallow-downloads Save the change and test on a non-production instance firstReload the document record and confirm the Download File button works as expected Important Notes: This applies to any custom implementation that embeds the Document Viewer or attachment viewer within an iframe using the sandbox attribute; it is not limited to a specific application or integrationPlatform upgrades may introduce changes to how the Document Viewer URL and behavior work, which can require updates to existing iframe configurations in custom implementationsDeveloping, modifying, and maintaining custom UI macros, scripts, and implementations is outside the scope of ServiceNow Technical Support. For customization assistance, engage your Solution Architect, Solution Consultant, or Expert Services teamIf the download still fails after adding all required permissions, verify the iframe source URL is accessible to the current user and that the attachment record existsAs a temporary workaround, attachments can always be downloaded through 'Manage Attachments' on the record form regardless of the viewer configuration