Disable/Hide download button in iframe on default PDF Viewer

Disable/Hide download button in iframe on default PDF Viewer

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Disable/Hide download button in iframe on default PDF Viewer

Attempting to strip the download button from a PDF embedded in an <iframe> is a common requirement when building document viewing portals. The frustration stems from the fact that browser-native PDF viewers, particularly Mozilla Firefox, often ignore standard query parameters intended to suppress UI elements.

When you append #toolbar=0&navpanes=0&scrollbar=0 to your PDF URL, you are relying on the PDF viewer's ability to parse these specific flags. In many implementations, this works as expected, cleaning up the interface. However, in Mozilla Firefox, these parameters frequently fail to hide the download icon located at the bottom right of the document canvas. Even injecting JavaScript directly into the iframe via jQuery, such as targeting an element with the ID toolbarViewerRight, often results in nothing happening because the internal DOM structure of the PDF viewer differs across browser implementations.

The core issue is that the default <embed> or <object> tags, when used without specific attributes, load the PDF using the system's preferred handler. On Firefox, this defaults to its built-in renderer, which treats the download button as a critical part of the document metadata interface rather than a removable UI element.

To achieve a truly clean viewing experience where the download link is removed, you must force the browser to use a different rendering engine that respects UI suppression flags. The most reliable method is to explicitly tell the browser to render the PDF using its internal viewer but with specific parameters that override the default behavior.

Instead of relying solely on the query string, you need to ensure the iframe forces the document into a mode where these parameters are honored. A robust approach involves configuring the iframe's source to include parameters that disable certain UI components while keeping others active if necessary.

<iframe 
    type="application/pdf" 
    id="pdf-frame" 
    src="https://example.com/document.pdf?toolbar=0&navpanes=0&scrollbar=0&showallcolors=true&layout=SinglePage" 
    width="100%" 
    height="685">
</iframe>

While the query parameters handle most of the toolbar suppression, simply hiding elements via JavaScript after the iframe loads is often ineffective against the download button in Firefox. This is because the element might not exist under the expected CSS selector, or it might be dynamically generated in a way that blocks direct DOM manipulation from the parent context.

If you require a solution that works universally across different browser versions and does not rely on fragile selectors, consider using a dedicated library designed to render PDFs within web applications. Libraries like pdf.js allow you to load the PDF document as an image or canvas element, completely bypassing the browser's native PDF viewer and its stubborn UI elements. This approach gives you full control over which buttons are displayed.

However, if sticking with native rendering is a priority for performance reasons, there is a specific configuration trick often overlooked: using the wmode="transparent" attribute alongside the query parameters can sometimes help isolate the iframe context, though it does not guarantee the removal of the download button in all versions of Firefox.

In enterprise environments where you need to enforce this behavior consistently, integrating a backend solution that serves the PDF with these specific headers and parameters is essential. You might also consider leveraging services provided by specialized document management platforms. For instance, resources like https://laravelcompany.com often discuss how to integrate secure document viewing into web applications, highlighting the importance of proper parameter passing to ensure consistent UI behavior across different client devices.

Ultimately, if the native PDF viewer continues to ignore your requests to hide the download button, you are facing a limitation of the browser's default handler rather than a bug in your code. The only guaranteed way to remove that specific element is to switch from the native viewer to a custom rendering engine or a library that exposes a clean API for UI configuration.

Our network