Redirect from LTI iFrame

Jump to solution
srg25
Community Participant

I want to redirect out of the LTI iFrame to the Canvas homepage.  When the user presses the cancel button, the event sends the user to the canvas homepage but it is within the LTI iFrame.  Does anybody know how to get out of the iFrame using javascript or C#?

Thank you,

Shawn

1 Solution
marinated_pork
Community Novice

In HTML you can add the property target="_parent" to your <a> tags and it will open a link from an iFrame in the parent window of the iFrame. So it would look like

<a href="http://google.com" target="_parent">Click here.</a>

OR

In JavaScript:

window.parent.location.href= "http://www.google.com";

Read more at these links:
     -html - how to force link from iframe to be opened in the parent window - Stack Overflow
     -HTML link target Attribute

View solution in original post