Skip to content

Commit 614a837

Browse files
committed
opener - do not open blank windows for non-http(s) links
1 parent 29e124a commit 614a837

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/vs/editor/browser/services/openerService.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,15 @@ export class OpenerService implements IOpenerService {
103103
// Default external opener is going through window.open()
104104
this._externalOpener = {
105105
openExternal: href => {
106-
dom.windowOpenNoOpener(href);
106+
// ensure to open HTTP/HTTPS links into new windows
107+
// to not trigger a navigation. Any other link is
108+
// safe to be set as HREF to prevent a blank window
109+
// from opening.
110+
if (matchesScheme(href, Schemas.http) || matchesScheme(href, Schemas.https)) {
111+
dom.windowOpenNoOpener(href);
112+
} else {
113+
window.location.href = href;
114+
}
107115
return Promise.resolve(true);
108116
}
109117
};

0 commit comments

Comments
 (0)