When a user tries to access a Canvas a course that requires authentication, she is forwarded to the login page. We would like to know which course the user tries to access and perform some actions in a custom javascript, depending on the course id.
F.ex.
1. Try to access https://bibsys.instructure.com/courses/499/pages/statistikk-v-dot-1-1
2. When clicking the link in 1. you are forwarded to https://bibsys.instructure.com/login and then on to https://bibsys.instructure.com/login/canvas
3. At this point, my custom javascript is loaded. How can I find out that the user tries to access course 499?
In step 1, this header seems to contain the information (i=499):