mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-23 17:00:24 +01:00
adding noopener and noreferrer to links in widgets
This commit is contained in:
@@ -545,6 +545,20 @@
|
|||||||
return str.toString().replace(escapeChars, replaceChar);
|
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 () {
|
isAndroidBrowser: function () {
|
||||||
// http://stackoverflow.com/questions/9286355/how-to-detect-only-the-native-android-browser
|
// http://stackoverflow.com/questions/9286355/how-to-detect-only-the-native-android-browser
|
||||||
var nua = navigator.userAgent;
|
var nua = navigator.userAgent;
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
title: $(this).attr('title'),
|
title: $(this).attr('title'),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
utils.addNoReferrer(widgetAreas);
|
||||||
$(window).trigger('action:widgets.loaded', {});
|
$(window).trigger('action:widgets.loaded', {});
|
||||||
callback();
|
callback();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user