What is the best, modern and most secure way to embed a PDF (preview) into a website?
02:23 19 Jun 2026

Aim

Just embed a PDF (preview) into a website. This is very likely a well-known use case.

Given I have this use case for showing a PDF preview, I am searching for a solution. And yes I know e.g. MDN always recommends just linking to PDF files, but user's UX in some applications (like document management etc.) is just much improved, when you have a preview of your file content directly in your website/application.

Research

I have read this MDN article on embedding technologies. There are basically embed/object and iframe (except of the tags specifically for video and audio etc., which are not relevant for this use case). It goes into the history etc., but what matters is what it recommends. And first, it reads as if it recommends embed/object for PDF:

the