0

I need to embed a page from a Learning Management System (LMS) within another page within the same LMS, I can achieve that, BUT as soon as you click a link from that page it opens within the iframe.

I can't change the links on the page that is being embedded - so I need some way to set the behavior for the links to open in the parent at the point where the iframe is added.

We have some limitations in terms of only being able to put inline CSS and HTML

if there is a viable solution but requires external CSS or Javascript I can propose it to those who have more access within the system then I do, but that would be a bit of a hail Mary on if I can get it approved (but I would certainly fight for it if that's the only option!)

If anyone has any ideas I'd really appreciate it.

I tried the following (but I wasn't really expecting it to work, just hoped)

<p><iframe src="CANVAS_LMS_DOMAIN/courses/COURSEID/modules?embedded=true" width="100%" height="900px"><head><base target="_parent"></head></iframe></p>

after saving the page the <head><base target="_parent"></head>

The head and base were stripped out.

I also tried `

" width="100%" height="900px">`

but after saving the page that was stripped back to

<p><iframe width="100%" height="900px"></iframe></p>

Ren Denim
  • 23
  • 3
  • sorry released part of the code stripped out, the second example of what I tried was utilising srcdoc to add the head tag and the iframe tag, but it stripped out also – Ren Denim Aug 01 '23 at 05:39
  • 1
    Content you put _between_ the `` tags would be considered the alternative to display instead of the iframed document, only if the browser could not handle inline frames. – CBroe Aug 01 '23 at 07:20
  • 1
    And your second attempt, using `srcdoc`, still only has the `base` element _outside_ of the iframe - so it affects your "first level" iframed document, but not the content inside the 2nd-level iframe that first one contains. – CBroe Aug 01 '23 at 07:21
  • 1
    You will need to use JavaScript, to manipulate the iframe content after it has loaded. You could either loop over all links and set their target attribute, or you dynamically create & insert a `base` element into the iframed document. – CBroe Aug 01 '23 at 07:23
  • Thanks @CBroe, I thought that would be the case I was just hoping for an alternative solution that didn't require me going through 10 levels of approval BS to try and get some JS added, but guess that's what I'm pursuing today! Thanks! – Ren Denim Aug 02 '23 at 22:59

0 Answers0