In Chrome clicking a link opens it in the same window. Clicking link in the preview part opens up a new tab.
In Firefox both actions open up the new tab.
Link opens up in the new tab.
Link opens up in the same window as where Rocket.Chat is displayed.
Hmm, looks like I cannot reproduce this anymore, although it worked like a clock earlier. I had refreshed browsers many times and all...
Will close this if we cannot reproduce it for a week or two.
can not reproduce this with Google Chrome Version 62.0.3202.62 (Offizieller Build) (64-Bit)
Not a problem with Chrome, happens in Firefox as well, seems to happen with scheme:// links, the problem is in the generated HTML.
Top link's HTML is:
<a href="http://rocket.chat" target="_blank" rel="noopener noreferrer">rocket.chat</a>
Middle link:
<a href="https://rocket.chat">https://rocket.chat</a>
Preview link:
<a href="https://rocket.chat" target="_blank"><strong>Rocket.Chat - Free, Open Source, Enterprise Team Chat</strong></a>
Middle link (the one where scheme:// is specified) is missing the target="_blank" attribute.
target="_blank" is also missing when you create the link with Markdown e.g. [link text](https://rocket.chat)
:+1:
We haven't seen this anymore (currently runnin 0.59.3), even without _blank in the href. The problem just vanished. :|
Does not seem to be happening in the app (tested on Windows), but it does happen in Chrome.
I can confirm that this always happen in chrome with the latest release (0.60.0-develop). We use RC in entreprise and all collabs have the problem. Hope that will can be fixed one day.
Is it possible to do something with Layout > Custom CSS to alter this behavior?
We have this issue in chrome with the marked parser
Happening here as well. Multiple browsers, RC version 0.64.0.
I can reproduce it on chromium for the instance my company runs. It started hapening after we updated the last time, I think. Sorry, I don't have more details, I will ask.
Also an issue on MacOS (Safari 11.1/MacOS 10.11.6).
I'm working around this for now with this userscript in case it's useful to anyone (replace // ==UserScript==
// @name Rocket.Chat Link Fixer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Forces links in messages in rocketchat to open in a new window
// @author tzar
// @match https://<add-your-domain-here>/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
$(document.body).on("click", ".message a", function(evt) {
evt.preventDefault();
evt.stopPropagation();
window.open(this.href, '_blank');
});
})();
The workaround posted above works in Chrome but unfortunately seems to break behavior in the client...
Can you guys please update your RC instance to the latest version (0.64.2) and try again? I can not reproduce the issues behavior with that version, all links get rendered with a target="_blank"
(macOS, High Sierra, tested with latest Chrome & Safari/Windows 10, tested with latest Chrome).
Thanks
I'd love to, but 0.64.* breaks slackbridge.
Hi, i've updated our RocketChat instance to the latest update (0.65.0-develop) and it seem that the problem persist ...
As you can see in the capture below, the link write by the user (display in blue) hasn't target="_blank" but, the generated preview block has it.
Why the first link has not the target="_blank" attribute ?
This is the only last problem persist for link that open in the RocketChat tab.
NB: @PeeterAngelo has already explain this problem in https://github.com/RocketChat/Rocket.Chat/issues/8564#issuecomment-340444938
Hope you understand :)
Hi @ndousson,
I still struggle to reproduce the issues behavior on open.rocket.chat =/
Hi @kaiiiiiiiii,
I've created a new private channel to be in the same context than you and i can't reproduce link with target="_blank".
As you can see in the capture above, the problem is always here.
I'm on Google Chrome Version 66.0.3359.181 (Build officiel) (64 bits) release.
I don't know why this happen for me and not for you 馃槥
@kaiiiiiiiii do you you have the marked parser in use?
Ah yes, indeed this might be related to the Marked parser, I mentioned here https://github.com/RocketChat/Rocket.Chat/issues/8564#issuecomment-340446641 that the problem also appears when creating a link with Markdown
Based on: https://github.com/markedjs/marked/issues/655#issuecomment-383226346
We should add:
var linkRenderer = renderer.link;
renderer.link = function(href, title, text) {
var html = linkRenderer.call(renderer, href, title, text);
return html.replace(/^<a /, '<a target="_blank" rel="nofollow" ');
};
Can confirm that depending on the chosen markdown parser the links receive target="_blank"
attribute or not. Changing the markdown parser to Original creates the correct HTML syntax.
Tested with Rocket.Chat version 0.65.1 in Chrome and Firefox.
That would make this issue a duplicate of #8115
Can confirm this behaviour , is there any plan to add target="_blank"
attribute to the the marked markdown parser ?
Any news here?
Is there a workaround for this? I'm having the same issue right now.
Can't reproduce this in 3.7.0-develop. Tried Every possible type of link:
I found a fix for this implemented about 1.5 years ago #13245.
Most helpful comment
Based on: https://github.com/markedjs/marked/issues/655#issuecomment-383226346
In: https://github.com/RocketChat/Rocket.Chat/blob/217073f4c010e8472a7521c998e89fd47c7a68ee/packages/rocketchat-markdown/parser/marked/marked.js
We should add: