Allow only http and https to open a new window
This commit is contained in:
@@ -272,6 +272,9 @@ var MattermostView = React.createClass({
|
|||||||
webview.addEventListener('new-window', function(e) {
|
webview.addEventListener('new-window', function(e) {
|
||||||
var currentURL = url.parse(webview.getURL());
|
var currentURL = url.parse(webview.getURL());
|
||||||
var destURL = url.parse(e.url);
|
var destURL = url.parse(e.url);
|
||||||
|
if (destURL.protocol !== 'http:' && destURL.protocol !== 'https:'){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (currentURL.host === destURL.host) {
|
if (currentURL.host === destURL.host) {
|
||||||
// New window should disable nodeIntergration.
|
// New window should disable nodeIntergration.
|
||||||
window.open(e.url, 'Mattermost', 'nodeIntegration=no');
|
window.open(e.url, 'Mattermost', 'nodeIntegration=no');
|
||||||
|
Reference in New Issue
Block a user