[ARCHIVED] LTI 1.3: Open in new tab

Jump to solution
jade_
Community Member

Hi! I'm working on a LTI 1.3 tool implementation (and have already got it working on the tool side with the reference implementation). I am having some trouble with Canvas however: my LTI 1.3 implementation does not support loading from within an iframe because the browser is (probably rightfully) eating my CSRF/state cookies if loaded in such a context, causing the initiation to fail. I know I can mess with the cookie properties so the browser will stop eating them, but I am not interested in evaluating the security implications of doing so at this time.

As such I'd much rather simply have Canvas open my tool in a new tab.

There have been questions on this forum about this before: https://community.canvaslms.com/t5/Question-Forum/What-are-LTI-settings-to-open-in-new-tab/m-p/23103... and https://community.canvaslms.com/t5/Developers-Group/How-to-configure-XML-for-LTI-to-open-in-new-tab/..., however both of those are using XML, implying they are for previous versions of LTI. I don't see anything in the JSON setup file documentation regarding how to do this, and I haven't seen anything in the UI (though I have not explored all the corners of it).

Reading the Canvas source code, it looks like there's something in app/views/lti/_lti_message.html.erb about this, and some kind of new_tab attribute that may or may not exist for LTI links? I am not a Ruby expert, and don't know how to trace it any further in the source code.

Anyone know how to do this?

Labels (2)
0 Likes
1 Solution
A_K_Dekker
Community Participant

Hi @jade_ ,

 

I think this is documented under 'Naviagtion tools' > 'placements'. For as far as I can tell it only seems possible if you use the Account or Course placement. I believe you can do this by adding the windowTarget: _blank parameter in your JSON. I`m not an expert on this though.

{  
   "title":"Cool Course Navigation Tool ",
   "scopes":[],
   "extensions":[  
      {  
         "domain":"coursenavexample.com",
         "tool_id":"course-nav",
         "platform":"canvas.instructure.com",
         "settings":{  
            "text":"Cool Course Navigation Tool Text",
            "icon_url":"https://some.icon.url",
            "placements":[                 
               {  
                  "text":"Cool App Dashboard",
                  "enabled":true,
                  "icon_url":"https://some.icon.url",
                  "placement":"course_navigation",
                  "message_type":"LtiResourceLinkRequest",
                  "target_link_uri":"https://your.target_link_uri/your_dashboard",
"windowTarget": "_blank" } ] } } ],

 

View solution in original post