Bug 240954 - <object> fails to load same PDF twice
Summary: <object> fails to load same PDF twice
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: PDF (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2022-05-26 07:27 PDT by Joe Woods
Modified: 2022-06-02 07:28 PDT (History)
4 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Joe Woods 2022-05-26 07:27:05 PDT
I believe this is new in Safari Technology preview, but I could be mistaken:

* Insert an `<object>` into the DOM, loading a PDF by the data attribute.
* Remove that `<object>`.
* Insert another `<object>` into the DOM, loading the same PDF by the data attribute.

All subsequent times the object should be loaded, the embedded PDF viewer will not work.

I have put together a minimal reproduction here: https://safari-pdf-issue.unstable.email/

Comment 1 Alexey Proskuryakov 2022-05-30 19:38:32 PDT
This reproduces for me with macOS 12.5 beta.

Looks like <object> gets a zero length PDF every time except the first load.

      document.getElementById("add").onclick = function () {
        const pdf = document.getElementById("pdf");
        if (pdf) {

        const newPdf = document.createElement("object");
        newPdf.setAttribute("data", "/dummy.pdf");
        newPdf.setAttribute("type", "application/pdf");
        newPdf.setAttribute("id", "pdf");

Comment 2 Radar WebKit Bug Importer 2022-06-02 07:28:13 PDT