Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
Hi everyone,
I’m exploring ways to add custom JavaScript to a specific course in Canvas LMS. I’ve looked into the Theme Editor, but that approach applies JavaScript globally or at the sub-account level.
I’m trying to inject custom JavaScript that runs only for a particular course.
I’ve explored LTI apps, but this is limited to individual pages, and I need something that works across the entire course context.
Has anyone implemented this, or does Canvas have an undocumented feature or workaround for course-level JavaScript customizations?
Any suggestions, workarounds, or confirmation on this would be greatly appreciated!
Solved! Go to Solution.
Hello @albinp - does your Uni provide you with your own web space? And do their policies permit you to use such JavaScript? I am asking as if I wanted to do something creative that Canvas does not provide for, then I would then either link to pages on my site or perhaps iframe the content into a Canvas page, etc.
Or perhaps ask for a special subaccount and create a single resource course that is open to anyone in the institution. This way you may be approved to use custom scripts in the theme and it would impact that course only. Then link to or embed pages of the open course to your course for the term. Jsut ideas. ;o)
@albinp Perfect. I think the easiest method would be for you to create a subaccount to which you can apply the custom js in the theme.
@albinp If you have theme editor access, you could theoretically put in javascript that is set to only apply to pages based on the url. Alternatively, you could put the course in its own subaccount and apply the code only to that subaccount.
Realistically, Canvas is not designed for specific courses to use their own code, as that makes support more difficult and makes the student experience less consistent. It is doable though, if you are an admin or can convince your instance's admin to put you in a subaccount and make you an admin in the subaccount.
Thanks for the reply, appreciate it.
Can this be done using LTI, for example, can I update the script in the theme editor using API, or can I add scripts that would appear on every page in the specific course?
I don't believe an LTI or API would be able to edit the theme of a subaccount. I don't see API endpoints for injecting javascript into the BrandConfig. @albinp Are you an admin in your Canvas instance?
Yes I am
@albinp Perfect. I think the easiest method would be for you to create a subaccount to which you can apply the custom js in the theme.
Hello @albinp - does your Uni provide you with your own web space? And do their policies permit you to use such JavaScript? I am asking as if I wanted to do something creative that Canvas does not provide for, then I would then either link to pages on my site or perhaps iframe the content into a Canvas page, etc.
Or perhaps ask for a special subaccount and create a single resource course that is open to anyone in the institution. This way you may be approved to use custom scripts in the theme and it would impact that course only. Then link to or embed pages of the open course to your course for the term. Jsut ideas. ;o)
To participate in the Instructure Community, you need to sign up or log in:
Sign In