cancel
Showing results for 
Search instead for 
Did you mean: 
hmcnally-vls
Surveyor II

How do you open an internal Canvas PDF file in a new tab: NOT a download, and NOT an inline preview

Hi,

 

I have an instructor who would prefer to open a specific PDF in a new tab when it it clicked.  They DO NOT want the file preview (easy enough), but the link syntax...

https://[domain]/courses/161/files/4288/download?wrap=1

...always forces a file download (as the URL suggests).  Is there some variant of this URL syntax, or an attribute within the <a> tag, that would change the MIME type.

As I type this, I realize that the bottom of the issue might be authentication; even so, an attempt to put a link like this into the HTML of a Canvas page...

https://[domain]/courses/161/files/4288/

...which would probably by OK for the instructor since it would look pretty similar to a browser-rendered PDF, gets pre-empted and changed by the Canvas text editor and is modified back into something looking like the above link.

 

0 Kudos
4 Replies

@James   it sounds like you are very comfortable working with the HTML options and coding for additional functions.

My caution with the custom-coded approach was formed the hard way when I (and those better equipped at my institution to implement coded workarounds because we could) encountered Canvas updates or new releases that suddenly incapacitated a course or an entire division's courses with these features! Guess whose fault it is and who is left holding the bag to fix hundreds of courses at crunch time?  Not Canvas.

Canvas is not responsible for the fallout when a custom solution that works for you suddenly stops.

Outside hosting or links to outside sites that the instructor maintains bring up content ownership and FERPA issues for my institutions, so we are trying to talk people out of this approach. 

Agreed.  This original scenario is not a good plan for overall accessibility standards, security logins, or course management from term to term. 

Neighboring tabs and browser management skills are ok to include in instructions with links to guides to newbies if (for example in higher ed writing assignments) the student needs to complete their assignment while frequently referencing the instructions.  Not perfect, just one possibility.

The overall question signals a need for better UX for the entire course and maximizing built-in Canvas features.  It is always a worse course experience for students--and I mean without exception--when the teacher or designers re-invent some sort of parallel system and awkward workarounds to avoid using a programmed Canvas feature in the way it is programmed.

I say this a lot:  Course creators get bored. Students get lost. 

Students who get lost a lot will then get bored from being lost and tune out.  The excitement needs to be in the subject matter, not the navigation. 

*Incidentally, my fellow Course and Faculty support techs and I used to refer to .pdf's as "the long road." 

Every faculty member who converts .docx to .pdf's without a real reason, needs to be corrected.  99% of the time .pdf is a mistake that creates more work down the road.  If you think you need your Syllabus to be in .pdf for some protective reason, just know that you, the teacher, will be the one to change it and update it, while overall this is a lot harder.  For example, If you think assignment directions need to be in .pdf, just try to update that when your faculty can't find the source doc and Adobe fouls up the format and adds misspelled words in a weird font.  Not fun. 

 

James
Navigator

@hmcnally-vls 

Removing the inline preview is fairly easy from a technical perspective, but does require a few extra clicks. See How do I disable inline previews for files using the Rich Content Editor as an instructor? (the RCE is being deprecated in January 2021) and How do I embed course and user documents in the New Rich Content Editor as an instructor? for more information. That doesn't stop the download, though.

One easy way to accomplish this is to host the PDF outside of Canvas in a domain that doesn't match the Canvas domain. If the top level domain does match (usually the top 2 components), then Canvas will treat it as an internal link and replace the existing window. This is not a problem if your Canvas is hosted by Instructure, but it can be an issue if you're self-hosting. Doing this loses the logging of the asset access in the access report, so the faculty won't be able to tell who has viewed it or how many times.

That doesn't handle the internal Canvas part, though. If the instructor insisted on this, I would tell the instructor to tell the teach the students to ctrl-click (or right click and open in new tab) the link so it opens in a new window. The instructor could add a note at the point of download.

Changing the behavior that the students use for their other classes is likely to cause problems and opening in a new tab without letting them know you're doing that can be bad for accessibility. Converting it to an image is bad for accessibility as well. You have to be concerned about what happens with the different devices, not just a browser. A faculty member who wants something like this normally only views things from their perspectives without thinking about how it functions for others.

The MIME type headers are sent by the server, which means that you're going to have trouble overriding them through anything that you put onto a page. This thread has a good discussion of the problem and some other recommendations about what can be done: Fix Bug in Canvas display of pdfs

nsweeten
Explorer III

This will endure through re-use in a Canvas course migration/copy with the login permissions intact because you aren't leaving Canvas or breaking a security rule.

Sort of...

As a designer and teacher, I generally loathe .pdf files in Canvas, but if your course makes it worthwhile for some reason, I can think of a roundabout way. 

Since a .pdf essentially functions as an "image of text" (a picture of a document, instead of the actual document) you don't lose much by making it a high-resolution jpeg that completely fills a Canvas page.

Then, you can make that internal page link open in a new tab. 

(I like to call those Inception-style links--fun huh?!--- those internal Canvas links inside of another Canvas RCE "box".  Usually not an example of premium UX navigation planning, but it sounds like you want students to have two tabs open side-by-side?  If so you will also want to include optional browser-tab handling instructions for lower skill-level students.)

Steps

  1. Convert your .pdf to an image file type.  (If the .pdf is long, you will need to create one image per page. A canvas content page will scroll to infinity, but you have to manage the page order yourself as you load.)
  2. Create your new Canvas Page. Choose the title of the canvas page how you want students to read it and how you want to locate it in the internal link tool. (Give it a real name, not some TC15_x7g.pdf)
  3. In edit mode on your page, upload one image at a time into files and on the page at the same time. (See Canvas Guides for step-by-step)  I recommend saving between each page unless you are a pro.  
  4. When your linkable Canvas page is ready, go to your "other" page or assignment's rich content editor (RCE) and select "edit" mode. 
  5. In the correct position in your instructions or Text, place the cursor and go the far-right column internal links tool (in original LMS view) and select your page name. (See image 1.)      Image 1.png
  6. The next step requires some minimal HTML skills and makes the Canvas page link open in a neighboring tab.  While still in edit mode, click the blue HTML link on the upper right corner of the RCE box. It will then display the blue word Rich Content Editor. (See Image 2)   Image 2.png
  7. Look for the<a </a> tags in the code and stay between them and away from any other command's "quotation marks"!  (See image 3)Image 3.png
  8. Insert the code snippet  target="_blank"
  9. Save and test the action.  When the link opens in a neighboring tab, you did it right.

Voila'

😀