Skip to content
Permalink
Browse files
adding noopener and noreferrer to links in widgets
  • Loading branch information
julianlam committed Jan 15, 2018
1 parent dacc9d6 commit f138d3cb70e96a6124c543092397c907d959d9d5
Showing with 15 additions and 0 deletions.
  1. +14 −0 public/src/utils.js
  2. +1 −0 public/src/widgets.js
@@ -545,6 +545,20 @@
return str.toString().replace(escapeChars, replaceChar);
},

addNoReferrer: function (containerEl) {
containerEl.find('a').attr('rel', function (idx, value) {
value = value ? value.split(' ') : [];

['noopener', 'noreferrer'].forEach(function (property) {
if (!value.includes(property)) {
value.push(property);
}
});

return value.join(' ');
});
},

isAndroidBrowser: function () {
// http://stackoverflow.com/questions/9286355/how-to-detect-only-the-native-android-browser
var nua = navigator.userAgent;
@@ -59,6 +59,7 @@
title: $(this).attr('title'),
});
});
utils.addNoReferrer(widgetAreas);
$(window).trigger('action:widgets.loaded', {});
callback();
};

0 comments on commit f138d3c

Please sign in to comment.