Open Bug 913960 Opened 11 years ago Updated 2 years ago

Provide some sort of attribute in the HTML that allows the PDF viewer to be detected

Categories

(Firefox :: PDF Viewer, enhancement, P4)

enhancement

Tracking

()

People

(Reporter: mkaply, Unassigned)

Details

(Whiteboard: [pdfjs-feature])

Currently it's not easy for an add-on to override anything about the PDF viewer (remove print button for example), because:

1. The CSS files are resource URLs which can't be overridden.
2. There's nothing in the HTML that can be used as a selector to detect the PDF viewer.

We should add some attribute to the HTML or BODY so that custom CSS rules can be written for the viewer.
Would a css class on the body be enough?
Priority: -- → P4
Whiteboard: [pdfjs-c-feature]
(In reply to Brendan Dahl [:bdahl] from comment #1)
> Would a css class on the body be enough?

That should be enough.

Was there a reason these files were done as resource files instead of chrome files?

Being resource files means that can't be overridden.
We run pdf.js under a resource url so it runs with content only permissions.  We could perhaps host the css under a chrome url.
(In reply to Brendan Dahl [:bdahl] from comment #3)
> We run pdf.js under a resource url so it runs with content only permissions.
> We could perhaps host the css under a chrome url.

That would be helpful, but the attribute is probably enough, as long as it was unique enough.

Since there's no way to detect PDF.js loads in a page load handler (is there?)
Really, this is about being able to customize the pdf viewer in an extension like we can other chrome resources.  The approach chosen appears to have favored something that is cross-browser compatible over something that is a first-class member of the Firefox ecosystem.  I'd like to be able to define an overlay or override to customize the viewer.  Having to resort to detecting pdf.js on page load by looking for a class on the body would be brittle and hard to discover. But right now I have to patch Firefox to customize it at all, so of course I'll take it if that is all we can do.
It doesn't look like this was ever done. This would still be really nice to have.
Severity: normal → --
Type: defect → enhancement
Whiteboard: [pdfjs-c-feature] → [pdfjs-feature]
You need to log in before you can comment on or make changes to this bug.