diff --git a/CHANGELOG b/CHANGELOG
index d2811bf425..5cfffabbeb 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,4 @@
+* Add noreferrer noopener to external URL (issue9089)
* Manage readonly dates in calendar view
* Manage editable on calendar view
* Manage named separator as label
diff --git a/src/common.js b/src/common.js
index 803d24176d..edb15e9ee9 100644
--- a/src/common.js
+++ b/src/common.js
@@ -3210,7 +3210,8 @@
.append(jQuery('', {
'class': 'btn btn-link',
href: Sao.config.bug_url,
- target: '_blank'
+ target: '_blank',
+ rel: 'noreferrer noopener',
}).text(Sao.i18n.gettext('Report Bug')))));
jQuery('', {
'class': 'btn btn-primary',
diff --git a/src/view/form.js b/src/view/form.js
index 2a064ba655..dfb6f708cd 100644
--- a/src/view/form.js
+++ b/src/view/form.js
@@ -3915,7 +3915,8 @@ function eval_pyson(value){
Sao.View.Form.URL._super.init.call(this, view, attributes);
this.button = jQuery('', {
'class': 'btn btn-default',
- 'target': '_new'
+ 'target': '_blank',
+ 'rel': 'noreferrer noopener',
}).appendTo(jQuery('', {
'class': 'input-group-btn'
}).appendTo(this.group));
@@ -3997,6 +3998,7 @@ function eval_pyson(value){
this.button = jQuery('', {
'class': 'btn btn-lnk',
'target': '_blank',
+ 'rel': 'noreferrer noopener',
}).text(attributes.string).appendTo(this.el);
if (attributes.translate) {
var button = jQuery('', {
diff --git a/src/view/tree.js b/src/view/tree.js
index a3fb94db01..7b1f1d5866 100644
--- a/src/view/tree.js
+++ b/src/view/tree.js
@@ -1870,7 +1870,8 @@
var cell;
if (this.protocol) {
cell = jQuery('', {
- 'target': '_new'
+ 'target': '_blank',
+ 'rel': 'noreferrer noopener',
});
cell.append(jQuery('
'));
cell.click({'cell': cell}, this.clicked.bind(this));
@@ -1911,7 +1912,7 @@
break;
}
}
- cell.attr('src', value);
+ cell.attr('href', value);
}
if (this.icon) {
if (this.icon in record.model.fields) {
@@ -1951,8 +1952,7 @@
return cell;
},
clicked: function(event) {
- event.preventDefault(); // prevent edition
- window.open(event.data.cell.attr('src'), '_blank');
+ event.stopPropagation(); // prevent edition
}
});