Change default target option
Manasa-wal opened this issue · comments
Manasa Bolisetti commented
How to change target option of anchor tag from "_self" to "_blank" and how to change css of anchor tag?
Page is not opening in new tab even when the checkbox "open link in a new tab" is checked
Manasa Bolisetti commented
I found that, the attribute target is being removed after sanitizing using DOMPurify.
So, to solve the issue..
use this code,
DOMPurify.addHook("afterSanitizeAttributes", function (node) {
if ("target" in node) {
node.setAttribute("target", "blank");
node.setAttribute("rel", "noopener");
}
});