diff --git a/lib/templates/plugin.js b/lib/templates/plugin.js index 5421073..0891cb6 100644 --- a/lib/templates/plugin.js +++ b/lib/templates/plugin.js @@ -19,8 +19,13 @@ export default ({ app: { router } }) => { const addListeners = links => { for (let i = 0; i < links.length; i++) { + const target = links[i].getAttribute('target') + if (links[i].hostname !== window.location.hostname && !target) { + links[i].target = '_blank'; + } + // For improved security `rel="noopener"` will be added automatically if target is `_blank` // https://github.com/mathiasbynens/rel-noopener/ if (target && target === '_blank') {