Skip to content

Conversation

@buckett
Copy link
Member

@buckett buckett commented Apr 29, 2025

When launching a LTI tool in a new window directly from Canvas it will not have a window.opener set because Canvas launches the new window to it's own URL (https://canvas.instructure.com...) which then redirects to the tool. Browsers block the window.opener property if it doesn't match the domain that the new window was opened with and in this case a LTI tool will be on a different domain.

This doesn't introduce a security issue because the checking of state is done in step 3 and if it was successfully set by a cookie the LTI launch will continue without a problem, but it does remove the pause that is seen when we don't have a valid window to send our post messages to.

When launching a LTI tool in a new window directly from Canvas it will not have a window.opener set because Canvas launches the new window to it's own URL (https://canvas.instructure.com...) which then redirects to the tool. Browsers block the window.opener property if it doesn't match the domain that the new window was opened with and in this case a LTI tool will be on a different domain.

This doesn't introduce a security issue because the checking of state is done in step 3 and if it was successfully set by a cookie the LTI launch will continue without a problem, but it does remove the pause that is seen when we don't have a valid window to send our post messages to.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR provides a workaround for handling LTI launches opened in a new window from Canvas where window.opener is not set.

  • Added a check for when the current window is the only available target frame.
  • Logs a message and redirects the window to the intended URL, relying on cookies as a fallback.

Copy link

@sebastianchristopher sebastianchristopher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@buckett buckett merged commit c417e5d into master Apr 30, 2025
1 check passed
@buckett buckett deleted the new-window-workaround branch April 30, 2025 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants