summaryrefslogtreecommitdiff
path: root/public/js/extra.js
diff options
context:
space:
mode:
authorChristoph (Sheogorath) Kern2018-10-04 20:08:42 +0200
committerGitHub2018-10-04 20:08:42 +0200
commitf186f733736a1e73fece235ef4952de7b703ec6c (patch)
tree2ddad812ed9a1f90f5a12a5e2e44253b218f8685 /public/js/extra.js
parentc35da4efe696ee56973e4d70ccc1d1fc0a870236 (diff)
parent75a23fe2c91d6c2f5008daccae72f8964af72307 (diff)
Merge pull request #982 from SISheogorath/feature/useNoOpener
Add rel="noopener" to target="_blank" links
Diffstat (limited to 'public/js/extra.js')
-rw-r--r--public/js/extra.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index d6bbb0c6..7a1077d5 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -570,7 +570,9 @@ export function postProcess (code) {
$(value).html(html)
})
// link should open in new window or tab
- result.find('a:not([href^="#"]):not([target])').attr('target', '_blank')
+ // also add noopener to prevent clickjacking
+ // See details: https://mathiasbynens.github.io/rel-noopener/
+ result.find('a:not([href^="#"]):not([target])').attr('target', '_blank').attr('rel', 'noopener')
// update continue line numbers
const linenumberdivs = result.find('.gutter.linenumber').toArray()
for (let i = 0; i < linenumberdivs.length; i++) {