Access the url of the Canvas page containing an iframe

jason_vermette
Community Member

I have several html pages that I load into pages on Canvas using iframes. Within those pages, I use javascript document.referrer to see what page on Canvas loaded my html page within the iframe. I do this so that I can make a page once and use it in many classes. Depending on the referrer url, my page knows which class linked to it and it loads the correct text, links, etc.

This has just recently stopped working:

Previously, document.referrer would give the full correct url, something like "https://mobap.instructure.com/courses/20533/pages/testing" 

Very recently, it only gives "https://mobap.instructure.com/"

This has broken almost every page and link in every one of my classes. I need to be able to access the full referrer url.

Has Canvas intentionally removed this ability? Or unintentionally? Or is it possible this is something my institution can control?

Is there another way to access the url of the page that is loading my iframe?

Many thanks.

0 Likes