cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
d_j_heslenfeld
Community Participant

Open links in new vs. current window

Jump to solution

I have created an announcemnet with 2 links (a href=...). There was no option to open a link in a new or in the current window or tab. It turns out that Canvas decided to open the first link in a new tab and the second one in the current tab. Why is that? And is there another way to force it except going to HTML editing and typing target="_blank" or target="_self" into the tag?

Thanks

Dirk Heslenfeld

1 Solution

Accepted Solutions
Stef_retired
Community Team
Community Team

Hi,  @d_j_heslenfeld  Welcome to the Canvas Community! I can't say why Canvas "chose" to open one in a new tab and one inline, but I think it will depend on whether the link is external or is directing to another place within the course itself. I tested this by creating a link to Google and a second link to another page within the course. The former opened in a new tab, and the latter opened in the same browser window, so my very quick albeit unscientific test supports this hypothesis.

And yes, there's another far easier way to set the target for a link without having to switch to the HTML Editor. From the Rich Content Editor, in editing mode, after you've created the link, click on the link and then click CTRL-K on a PC, or CMD-K on a Mac. That will open a dialog box that lets you set a "new window" target as well as the text to display and the title for for the link.

View solution in original post

9 Replies
Stef_retired
Community Team
Community Team

Hi,  @d_j_heslenfeld  Welcome to the Canvas Community! I can't say why Canvas "chose" to open one in a new tab and one inline, but I think it will depend on whether the link is external or is directing to another place within the course itself. I tested this by creating a link to Google and a second link to another page within the course. The former opened in a new tab, and the latter opened in the same browser window, so my very quick albeit unscientific test supports this hypothesis.

And yes, there's another far easier way to set the target for a link without having to switch to the HTML Editor. From the Rich Content Editor, in editing mode, after you've created the link, click on the link and then click CTRL-K on a PC, or CMD-K on a Mac. That will open a dialog box that lets you set a "new window" target as well as the text to display and the title for for the link.

View solution in original post

d_j_heslenfeld
Community Participant

Thanks! Both were external links in my case. The control-K dialog is much better than the standard "Link to URL" dialog, thanks for that!

Dirk

Thank you! But this should be done more easy for us, by Canvas.

CTRL-K on a PC, or CMD-K on a Mac. I'm thrilled to know this trick. I will use it A LOT and share it with colleagues.

 @whitney_clay ‌, if you like that trick, you'll love the tips in Your ideas of Canvas' best kept secrets‌.

Thank you, Stephanie!

I wanted a page within Canvas to open in the same window and yet it keeps opening a new one. For one of my courses, I removed the link and tried again. This time it worked (opened within same window). But it didn't do this for the other course. Any ideas? Very frustrating.

I don't understand how this trick is used. Can you elaborate please?

James
Community Champion

@cazarcon 

I do not know if this is what you are experiencing or not, but you asked for ideas.

Adding a link to course content by going to Links > Course Links will make it a link that opens in the same window. If you then use the "Link Options" and click "Done" then it changes things.

It now opens in a new browser window when you click it. Behinds the scenes, it adds these attributes to the link: class="inline_disabled" target="_blank" rel="noopener noreferrer"

It is the target="_blank" that causes it to open in a new window. If you go into the HTML editor, find the link, remove the target="_blank", and save your changes, then it will open in the same window.

The rel (relationship) attribute can be deleted at the same time, but it is not the attribute that makes it open in the new window.

Even if you did not click on Link Options, you can still go into the HTML editor to clean up the HTML. Often, removing and adding the link may be faster, but sometimes there can be underlying issues with the HTML that can only be resolved with the editor.