Fix Bug in Canvas display of pdfs

Idea created by Melissa Hines on Jan 24, 2019
    Open for Voting

    Bug: Canvas overrides user browser preferences when pdfs are linked from Canvas servers, forcing Canvas-hosted pdfs (or jpegs, etc.)  to download instead of being displayed within the browser. (This behavior does not happen on iPads; there the pdfs are displayed correctly.) As far as I can tell, there is no way to force Canvas to behave. This appears to be an issue with the HTTP headers being sent by the Canvas server.


    There are numerous complaints about this on the Canvas communities.


    Requested fix: Allow user browser preferences to determine whether the pdfs are displayed inline or downloaded.



    (2) Current “solutions": This problem has been mentioned many times in the Canvas community over the past few years. When I raised this problem with Canvas support, the bug was acknowledged, and I was told there is currently no fix or workaround. Problematic workarounds that have been suggested as solutions are:


    Host pdfs on Google drive: Although this solution works, it is horribly insecure, as anyone with the link (or any web crawler, I presume) will be able to access the files. In other words, all lectures and problem set solutions would be indexed by Google and freely available to the world. Very bad idea.


    Insert pdf into a Canvas page, then open the page instead of the pdf: This solution limits accessibility for a number of reasons. First and foremost, this “solution” leads to a preview that is limited to a small part of the browser window with all of the Canvas menus and other crap taking up most of the display. This limits accessibility, particularly on laptops. Additionally, there are many reports of  problems with the inline Canvas display (e.g., chopping off pages, corrupt display). Math faculty who have many scanned pages of solutions appear particularly irate.


    Convert all pdfs to jpeg: This creates accessibilty issues, takes faculty time, creates very bloated websites, and is a gnarly kludge.


    Live with it: This sucks and does not conform to good website design. Why force students to download their homework, for example, and view it in a second application? There are many times when users just need to check something quickly (e.g, a problem set solution). If students prefer their pdfs to be downloaded, they can always override the website designer through their browser preferences.



    (3) Possible solution:

    Root cause: The origin of this behavior appears to be inappropriately set HTTP headers by the Canvas server. Any attempts to override this behavior (e.g., by setting the MIME type with a type="application/pdf" tag) will not work, because the server's instructions (i.e., HTTP headers) are supposed to override the browser.


    Working from the suggestion on the Canvas user boards (look for comments by Wilmer Prentius), I examined the header being returned by Canvas when the pdf is served:


    content-disposition: attachment; filename="Cornell_Notes.pdf"
    content-type: application/pdf


    This means that the browser knows it is getting a pdf (content-type) but the server is telling it to download the file irrespective of the user's preferences (content-disposition).


    Other issues: See the comment by Karen Matson in the same thread on the Canvas user boards about problems with the native Canvas pdf preview. In my opinion, it is a bad idea to go with custom pdf previewers because of issues like this. It would be far better to allow previews by well tested software (e.g., Apple, Adobe).