Add rel="noopener noreferrer" to external links

Background:
https://medium.com/@jitbit/target-blank-the-most-underestimated-vulnerab
ility-ever-96e328301f4c#.hduwdbjlb
This commit is contained in:
Jermolene
2016-05-05 11:49:40 +01:00
parent 8a08eee4bd
commit 3a3754aebb
17 changed files with 22 additions and 16 deletions
@@ -1,6 +1,6 @@
title: $:/plugins/tiddlywiki/powered-by-tiddlywiki/banner
tags: $:/tags/PageTemplate
<a href="http://tiddlywiki.com" target="_blank">
<a href="http://tiddlywiki.com" target="_blank" rel="noopener noreferrer">
[img width="160px" class="tc-powered-by-tiddlywiki-banner" [$:/plugins/tiddlywiki/powered-by-tiddlywiki/powered-by-tiddlywiki.svg]]
</a>
+1
View File
@@ -97,6 +97,7 @@ RailroadWidget.prototype.patchLinks = function(node) {
if(child.attributes["data-tw-external"]) {
// External links are straightforward
child.setAttribute("target","_blank");
child.setAttribute("rel","noopener noreferrer");
} else {
// Each internal link gets its own onclick handler, capturing its own copy of target
(function(myTarget) {