pipwerks / PDFObject

A lightweight JavaScript utility for dynamically embedding PDFs in HTML documents.
http://pdfobject.com/
Other
2.39k stars 986 forks source link

Optional lazy loading of iframes #274

Closed SoftCreatR closed 1 year ago

SoftCreatR commented 2 years ago

It would be nice, if we could optionally set the loading-attribute to generated iframes for lazy loading.

See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe?retiredLocale=de#attr-loading

pipwerks commented 2 years ago

Not a bad idea, but that feature is still listed by Mozilla as experimental and subject to change. I'd wait until it's more widely supported.

SoftCreatR commented 2 years ago

But there's no downside, when implementing it, even if not all Browsers support it yet.

pipwerks commented 2 years ago

Actually, there's quite a bit of downside, including:

And so on. I've been around long enough to have been bitten by this before, I will wait until the feature is more mature. But it's good to see this feature is in the works. Thanks for the suggestion.

SoftCreatR commented 2 years ago

That's why I've suggested to make this optional ;) Alternatively, you could just add the possibility for developers to add custom properties to the generated iframes.

theodore-s-beers commented 2 years ago

Alternatively, you could just add the possibility for developers to add custom properties to the generated iframes.

This might be worth thinking about. It could eventually reduce the maintainership burden on PDFObject. People ask for a new embed/iframe property, and you can tell them to feel free to pass it raw on their own.

SoftCreatR commented 2 years ago

That's what I thought.

pipwerks commented 1 year ago

I'll reopen as a feature request for ability to add attributes to the embed/iframe elements.

pipwerks commented 1 year ago

Resolved with 2.2.9 release