On a Page, I'm trying to pass data that to an html file I'm loading via iframe. The main data I need right now is current user/course data, so passing data from the window.ENV object would be ideal.
Note: I am just an instructor, thus I do not have admin rights.
The pages I load are from a different course, which I use sort of like a repository for shared content. In the URL below, that's the MY_REPO_COURSE_ID.
So, so many things. Here are a few of my attempts...
I'm pretty close, so I hope it's just that I'm missing something obvious. I.e., I just haven't come across the right page in the documentation.
Sorry to bother the board with something I figured I'd be able to solve, and I'd be grateful for any ideas or suggestions.
Also, I came up with a partial solution -- I can get the current courseId by having JS on the iframe page that parses the URL from document.referrer. That's not a perfect solution, but it's helpful in the short-term.
@jason_vermette I saw your post about something similar to this. Did you ever figure out a way to read the parent URL from within the iframed content?
(my document.referrer plan doesn't work on Firefox)
Hi B_D_T,
If I understand correctly you're attempting to pass data from a Canvas page to another page that you've embedded as an iframe. This is a form of cross-site scripting and simply won't be possible in any normal browser, and Canvas will and should block any attempt at doing so regardless of what browser you're using. It's a massive security concern - imagine the data theft and sabotage students or anyone else would be able to do on the system if they were capable of harvesting data from the site via embedded scripts or sending malicious code to the Canvas system via an external site.
I get the need, though. I've struggled with similar issues over the years and I still have some issues that I cannot solve since it's so limited what HTML you can use on a Canvas page (in the HTML editor), which quickly leads one to thinking that building a page externally and embedding it on the page is the best solution. But then you lose all Canvas functionality and there is, to my knowledge, no way to bridge this gap.
Typically, you'd upload JavaScript and CSS to the Theme Editor in Canvas and then there's no limit to what you can achieve on a regular Canvas page. Or, if you're just trying to fetch certain data, you'd send a request via the Canvas API, but both of these approaches require administrative privileges.
Depending what data you're trying to fetch I might be able to help, but I'll need a detailed description of exactly what you're trying to fetch for use on the external page.
Michael
Hi everyone, If you write integrations against Canvas by Instructure at an institution — K-12, higher ed, corporate training, government, or anywhere in between — we'd love your feedback. We're running a short survey on the Canvas developer experience: APIs, data access, tooling, and documentation. Results will feed into…
I'm currently integrating an LTI tool and attempting to use the Activity.id.history https://canvas.instructure.com/doc/api/file.tools_variable_substitutions.html#activity-id-history variable, but I'm experiencing issues getting it to work properly. What I've Done: Added the Activity.id.history variable to my Developer…
I looked through the LTI Variable Substitutions documentation and while there are variable substitutions available for Canvas.term.name and Canvas.term.id (which is the Canvas incremented ID like "104"), I was surprised to see there was no option for Canvas.term.sisSourceId I tried testing other possible variants that may…
I have a developer key in our Test instance: How would I use this in a local program to make a REST API call? Looking at https://developerdocs.instructure.com/services/canvas/oauth2/file.developer_keys: Developer keys are OAuth2 client ID and secret pairs stored in Canvas that allow third-party applications to request…
I'm building a tool for my institution that imports grades from another LTI tool into Canvas so instructors can automate late assignment policies not otherwise supported by Canvas. I'm trying to use the LTIv1.3 ID which is readily available on the LTI-side as a link to the student record on Canvas, but I can't find the ID…